public class SftpDirEntryIterator extends AbstractLoggingBean implements java.util.Iterator<SftpClient.DirEntry>, java.nio.channels.Channel
Modifier and Type | Field and Description |
---|---|
private SftpClient |
client |
private boolean |
closeOnFinished |
private java.util.List<SftpClient.DirEntry> |
dirEntries |
private SftpClient.Handle |
dirHandle |
private java.lang.String |
dirPath |
private java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> |
eolIndicator |
private int |
index |
private java.util.concurrent.atomic.AtomicBoolean |
open |
log
Constructor and Description |
---|
SftpDirEntryIterator(SftpClient client,
SftpClient.Handle dirHandle) |
SftpDirEntryIterator(SftpClient client,
java.lang.String path) |
SftpDirEntryIterator(SftpClient client,
java.lang.String path,
SftpClient.Handle dirHandle,
boolean closeOnFinished) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
SftpClient |
getClient()
The client instance
|
SftpClient.Handle |
getHandle() |
java.lang.String |
getPath()
The remotely accessed directory path
|
boolean |
hasNext() |
boolean |
isCloseOnFinished() |
boolean |
isOpen() |
protected java.util.List<SftpClient.DirEntry> |
load(SftpClient.Handle handle) |
SftpClient.DirEntry |
next() |
void |
remove() |
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
private final java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> eolIndicator
private final java.util.concurrent.atomic.AtomicBoolean open
private final SftpClient client
private final java.lang.String dirPath
private final boolean closeOnFinished
private SftpClient.Handle dirHandle
private java.util.List<SftpClient.DirEntry> dirEntries
private int index
public SftpDirEntryIterator(SftpClient client, java.lang.String path) throws java.io.IOException
client
- The SftpClient
instance to use for the iterationpath
- The remote directory pathjava.io.IOException
- If failed to gain access to the remote directory pathpublic SftpDirEntryIterator(SftpClient client, SftpClient.Handle dirHandle)
client
- The SftpClient
instance to use for the iterationdirHandle
- The directory SftpClient.Handle
to use for listing the entriespublic SftpDirEntryIterator(SftpClient client, java.lang.String path, SftpClient.Handle dirHandle, boolean closeOnFinished)
client
- The SftpClient
instance to use for the iterationpath
- A hint as to the remote directory path - used only for loggingdirHandle
- The directory SftpClient.Handle
to use for listing the entriescloseOnFinished
- If true
then close the directory handle when all entries have been exhaustedpublic final SftpClient getClient()
SftpClient
instance used to access the remote folderpublic final java.lang.String getPath()
SftpClient.Handle
instead of
via a path - used only for loggingpublic final SftpClient.Handle getHandle()
SftpClient.Handle
used to access the remote directorypublic boolean hasNext()
hasNext
in interface java.util.Iterator<SftpClient.DirEntry>
public SftpClient.DirEntry next()
next
in interface java.util.Iterator<SftpClient.DirEntry>
public boolean isOpen()
isOpen
in interface java.nio.channels.Channel
public boolean isCloseOnFinished()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface java.nio.channels.Channel
java.io.IOException
protected java.util.List<SftpClient.DirEntry> load(SftpClient.Handle handle)
public void remove()
remove
in interface java.util.Iterator<SftpClient.DirEntry>