com.ssh.sft
Class DirHandle

java.lang.Object
  extended bycom.ssh.sft.SftLib
      extended bycom.ssh.sft.SftBase
          extended bycom.ssh.sft.ObjectBase
              extended bycom.ssh.sft.DirHandle
All Implemented Interfaces:
Iterator, SftLibConstants

public class DirHandle
extends com.ssh.sft.ObjectBase
implements Iterator

An iterator over directory contents. A DirHandle is used to traverse once through the contents of a directory. It can be used via the standard Iterator interface, or with the nextEntry() method. The system resources reserved by a DirHandle object are freed when all entries are iterated, when the object is garbage collected, or when ObjectBase.close() is called, whichever comes first.


Field Summary
 
Fields inherited from interface com.ssh.sft.SftLibConstants
SSH_SFT_API_VERSION, SSH_SFT_DIR_RECURSIVE, SSH_SFT_HASH_MAX_BLOCK_SIZE, SSH_SFT_HASH_MAX_ITERATIONS, SSH_SFT_HASH_MIN_BLOCK_SIZE, SSH_SFT_REQUEST_MAX_NUM, SSH_SFT_REQUEST_MAX_SIZE
 
Method Summary
 void close()
          Releases the resources used by this object.
 boolean hasNext()
          Tests if there are more directory entries still available.
 boolean isClosed()
          Tests if this object has been closed.
 Object next()
          Returns the next entry in this directory.
 File nextEntry()
          Returns the next entry in this directory.
 void remove()
          Removes from this directory the last file that was returned by next() or nextEntry().
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasNext

public boolean hasNext()
Tests if there are more directory entries still available.

Specified by:
hasNext in interface Iterator
Returns:
true if calling next() will return another entry

next

public Object next()
Returns the next entry in this directory.

Specified by:
next in interface Iterator
Returns:
the next unread entry in this directory
Throws:
NoSuchElementException - if there are no more entries available

nextEntry

public File nextEntry()
               throws SftException
Returns the next entry in this directory.

Returns:
the next unread entry in this directory, or null if there are no more entries
Throws:
SftException

remove

public void remove()
Removes from this directory the last file that was returned by next() or nextEntry().

Specified by:
remove in interface Iterator

close

public void close()
           throws SftException
Releases the resources used by this object. After this method has been called, all further operations on this object will throw a IllegalStateException.

Throws:
SftException

isClosed

public boolean isClosed()
Tests if this object has been closed.

Returns:
true if ObjectBase.close() has been called on this object, false otherwise