Package org.apache.sshd.sftp.client.fs
Class SftpDirectoryStream
- java.lang.Object
-
- org.apache.sshd.sftp.client.fs.SftpDirectoryStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<java.nio.file.Path>
,java.nio.file.DirectoryStream<java.nio.file.Path>
public class SftpDirectoryStream extends java.lang.Object implements java.nio.file.DirectoryStream<java.nio.file.Path>
Implements a remoteDirectoryStream
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path>
filter
private SftpPath
path
protected SftpPathIterator
pathIterator
private SftpClient
sftp
-
Constructor Summary
Constructors Constructor Description SftpDirectoryStream(SftpPath path)
SftpDirectoryStream(SftpPath path, java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
SftpClient
getClient()
Client instance used to access the remote directoryjava.nio.file.DirectoryStream.Filter<? super java.nio.file.Path>
getFilter()
SftpPath
getRootPath()
java.util.Iterator<java.nio.file.Path>
iterator()
-
-
-
Field Detail
-
pathIterator
protected SftpPathIterator pathIterator
-
path
private final SftpPath path
-
filter
private final java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter
-
sftp
private final SftpClient sftp
-
-
Constructor Detail
-
SftpDirectoryStream
public SftpDirectoryStream(SftpPath path) throws java.io.IOException
- Parameters:
path
- The remoteSftpPath
- Throws:
java.io.IOException
- If failed to initialize the directory access handle
-
SftpDirectoryStream
public SftpDirectoryStream(SftpPath path, java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter) throws java.io.IOException
- Parameters:
path
- The remoteSftpPath
filter
- An optionalfilter
- ignored ifnull
- Throws:
java.io.IOException
- If failed to initialize the directory access handle
-
-
Method Detail
-
getClient
public final SftpClient getClient()
Client instance used to access the remote directory- Returns:
- The
SftpClient
instance used to access the remote directory
-
getRootPath
public final SftpPath getRootPath()
- Returns:
- The root
SftpPath
for this directory stream
-
getFilter
public final java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> getFilter()
- Returns:
- The original filter - may be
null
to indicate no filter
-
iterator
public java.util.Iterator<java.nio.file.Path> iterator()
- Specified by:
iterator
in interfacejava.nio.file.DirectoryStream<java.nio.file.Path>
- Specified by:
iterator
in interfacejava.lang.Iterable<java.nio.file.Path>
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
-