Package org.apache.sshd.sftp.client.fs
Class SftpFileSystem
java.lang.Object
java.nio.file.FileSystem
org.apache.sshd.common.file.util.BaseFileSystem<SftpPath>
org.apache.sshd.sftp.client.fs.SftpFileSystem
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ClientSessionHolder
,SessionContextHolder
,SessionHolder<ClientSession>
- Direct Known Subclasses:
SftpFileSystemAutomatic
public class SftpFileSystem
extends BaseFileSystem<SftpPath>
implements SessionHolder<ClientSession>, ClientSessionHolder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
protected static class
TheSftpFileSystem.SftpClientPool
storesSftpClient
s not directly but via handles in its channel pool.protected class
A pool ofSftpClient
s.private final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicReference
<ClientSession> private SftpPath
private final SftpErrorDataHandler
private final SftpClientFactory
private final String
private final AtomicBoolean
static final AttributeRepository.AttributeKey
<Boolean> AnAttributeRepository.AttributeKey
that can be set toBoolean.TRUE
on theClientSession
to tell theSftpFileSystem
that it owns that session and should close it when theSftpFileSystem
itself is closed.private SftpFileSystem.SftpClientPool
private int
private final SftpVersionSelector
static final NavigableSet
<String> private int
private int
Fields inherited from class org.apache.sshd.common.file.util.BaseFileSystem
log
-
Constructor Summary
ConstructorsModifierConstructorDescriptionSftpFileSystem
(SftpFileSystemProvider provider, String id, ClientSession session, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler) protected
SftpFileSystem
(SftpFileSystemProvider provider, String id, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected SftpPath
final String
getId()
int
final SftpVersionSelector
final int
int
protected void
init()
boolean
isOpen()
provider()
protected ClientSession
protected void
setClientSession
(ClientSession newSession) void
setReadBufferSize
(int size) void
setWriteBufferSize
(int size) toString()
Methods inherited from class org.apache.sshd.common.file.util.BaseFileSystem
appendDedupSep, create, create, getPath, getPathMatcher, getRootDirectories, getSeparator, globToRegex, handleWindowsSeparator, hostFsHasWindowsSeparator, isReadOnly, newWatchService
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sshd.common.session.SessionHolder
getSessionContext
-
Field Details
-
UNIVERSAL_SUPPORTED_VIEWS
-
OWNED_SESSION
AnAttributeRepository.AttributeKey
that can be set toBoolean.TRUE
on theClientSession
to tell theSftpFileSystem
that it owns that session and should close it when theSftpFileSystem
itself is closed. -
id
-
factory
-
selector
-
errorDataHandler
-
pool
-
version
private int version -
supportedViews
-
defaultDir
-
readBufferSize
private int readBufferSize -
writeBufferSize
private int writeBufferSize -
stores
-
open
-
clientSession
-
-
Constructor Details
-
SftpFileSystem
public SftpFileSystem(SftpFileSystemProvider provider, String id, ClientSession session, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler) throws IOException - Throws:
IOException
-
SftpFileSystem
protected SftpFileSystem(SftpFileSystemProvider provider, String id, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler)
-
-
Method Details
-
init
- Throws:
IOException
-
getSftpVersionSelector
-
getSftpErrorDataHandler
-
getId
-
getVersion
public final int getVersion() -
provider
- Overrides:
provider
in classBaseFileSystem<SftpPath>
-
getFileStores
- Overrides:
getFileStores
in classBaseFileSystem<SftpPath>
-
getReadBufferSize
public int getReadBufferSize() -
setReadBufferSize
public void setReadBufferSize(int size) -
getWriteBufferSize
public int getWriteBufferSize() -
setWriteBufferSize
public void setWriteBufferSize(int size) -
create
- Specified by:
create
in classBaseFileSystem<SftpPath>
-
getClientSession
- Specified by:
getClientSession
in interfaceClientSessionHolder
- Returns:
- The underlying
ClientSession
used
-
getSession
- Specified by:
getSession
in interfaceSessionHolder<ClientSession>
-
setClientSession
-
sessionForSftpClient
- Throws:
IOException
-
getClient
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classFileSystem
- Throws:
IOException
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in classFileSystem
-
supportedFileAttributeViews
- Specified by:
supportedFileAttributeViews
in classFileSystem
-
getUserPrincipalLookupService
- Specified by:
getUserPrincipalLookupService
in classFileSystem
-
getDefaultDir
- Overrides:
getDefaultDir
in classBaseFileSystem<SftpPath>
-
toString
-