Servertec
Foundation Classes
1.3.3 09/04/2005

stec.sfc.Win32
Class FileEnumerator

java.lang.Object
  extended by stec.sfc.Win32.FileEnumerator

public final class FileEnumerator
extends java.lang.Object

Used to enumerate throught all the files matching the specified mask.

If a file mask is not specified then only the specified item is returned.

. and .. are normally included in a directory listing.

Since:
1.2.0 12/03/2002

Constructor Summary
FileEnumerator(java.lang.String path)
          Constructs a new FileEnumerator object.
 
Method Summary
 void close()
          Close this FileEnumerator.
 int getAttributes()
          Returns the current file's attributes as defined in FileAttribte.
 long getCreationTime()
          Returns the current file's creation timestamp.
 long getLastAccessedTime()
          Returns the current file's last accessed timestamp.
 long getLastModifiedTime()
          Returns the current file's last modified timestamp.
 java.lang.String getName()
          Returns the current file's name.
 void getNextFile()
          Called to retrieve the next entry.
 long getSize()
          Returns the current file's size in bytes.
 boolean hasMoreFiles()
          Returns whether there are any more files in this FileEnumeration.
 boolean isOpen()
          Returns whether the FileEnumerator is open.
 java.lang.String toString()
          Returns the specified path.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileEnumerator

public FileEnumerator(java.lang.String path)
               throws java.io.IOException
Constructs a new FileEnumerator object.

If one or more elements are available the constructor retrieves the first element.

Parameters:
path - the file path including any wildcard characters (* and ?).

If a file mask is not specified then only the specified item is returned.

Throws:
java.io.IOException - if an IO error occurs.
Method Detail

close

public final void close()
                 throws java.io.IOException
Close this FileEnumerator.

Although finalize() closes any FileEnumerator left opened when the garbage collector does its cleanup, it is recommened that FileEnumerator be explicitely closed as soon as they are no longer needed.

Throws:
java.io.IOException - if the FileEnumerator is already closed or if an IO error occurs.

getAttributes

public final int getAttributes()
                        throws java.io.IOException
Returns the current file's attributes as defined in FileAttribte.

Returns:
the current file's attributes.
Throws:
java.io.IOException - if the FileEnumerator is already closed or if an IO error occurs.

getCreationTime

public final long getCreationTime()
                           throws java.io.IOException
Returns the current file's creation timestamp.

Returns:
the current file's creation timestamp.
Throws:
java.io.IOException - if the FileEnumerator is already closed or if an IO error occurs.

getLastModifiedTime

public final long getLastModifiedTime()
                               throws java.io.IOException
Returns the current file's last modified timestamp.

Returns:
the current file's last modified timestamp.
Throws:
java.io.IOException - if the FileEnumerator is already closed or if an IO error occurs.

getLastAccessedTime

public final long getLastAccessedTime()
                               throws java.io.IOException
Returns the current file's last accessed timestamp.

Returns:
the current file's last accessed timestamp.
Throws:
java.io.IOException - if the FileEnumerator is already closed or if an IO error occurs.

getSize

public final long getSize()
                   throws java.io.IOException
Returns the current file's size in bytes.

Returns:
the current file's size in bytes.
Throws:
java.io.IOException - if the FileEnumerator is already closed or if an IO error occurs.

hasMoreFiles

public final boolean hasMoreFiles()
                           throws java.io.IOException
Returns whether there are any more files in this FileEnumeration.

Returns:
whether there are any more files in this FileEnumeration.
Throws:
java.io.IOException - if the FileEnumerator is already closed or if an IO error occurs.

getName

public final java.lang.String getName()
                               throws java.io.IOException
Returns the current file's name.

Returns:
the current file's name.
Throws:
java.io.IOException - if the FileEnumerator is already closed or if an IO error occurs.

getNextFile

public final void getNextFile()
                       throws java.io.IOException,
                              java.util.NoSuchElementException
Called to retrieve the next entry.

Unlike Enumeration.nextElement() which is called before the first element is retrieved, getNextFile() must be called to retrieve the next element after the first element is processed.

Throws:
java.utils.NoSuchElementException - if there were no more files.
java.io.IOException - if the FileEnumerator is already closed or if an IO error occurs.
java.util.NoSuchElementException

isOpen

public final boolean isOpen()
Returns whether the FileEnumerator is open.

Returns:
whether the FileEnumerator is open.

toString

public final java.lang.String toString()
Returns the specified path.

Overrides:
toString in class java.lang.Object
Returns:
the specified path.

Servertec
Foundation Classes
1.3.3 09/04/2005

Copyright © 2001-2005 Servertec. All rights reserved.