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 classstatic classstatic classprivate classprivate classSftpClient with support for getting supported file attribute views and the server-side default directory.private classThe file system hands out only Wrapper instances to prevent the underlying SftpClient from being closed. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicReference<ClientSession> private final SftpErrorDataHandlerprivate final SftpClientFactoryprivate final Stringprivate final AtomicBooleanstatic final AttributeRepository.AttributeKey<Boolean> AnAttributeRepository.AttributeKeythat can be set toBoolean.TRUEon theClientSessionto tell theSftpFileSystemthat it owns that session and should close it when theSftpFileSystemitself is closed.private intprivate final SftpVersionSelectorstatic final NavigableSet<String> private intFields inherited from class BaseFileSystem
log -
Constructor Summary
ConstructorsModifierConstructorDescriptionSftpFileSystem(SftpFileSystemProvider provider, String id, ClientSession session, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler) protectedSftpFileSystem(SftpFileSystemProvider provider, String id, SftpClientFactory factory, SftpVersionSelector selector, SftpErrorDataHandler errorDataHandler) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected SftpPathfinal StringgetId()intfinal SftpVersionSelectorfinal intintprotected voidinit()booleanisOpen()provider()protected ClientSessionprotected voidsetClientSession(ClientSession newSession) voidsetReadBufferSize(int size) voidsetWriteBufferSize(int size) toString()Methods inherited from class BaseFileSystem
appendDedupSep, create, create, getPath, getPathMatcher, getRootDirectories, getSeparator, globToRegex, handleWindowsSeparator, hostFsHasWindowsSeparator, isReadOnly, newWatchServiceMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface SessionHolder
getSessionContext
-
Field Details
-
UNIVERSAL_SUPPORTED_VIEWS
-
OWNED_SESSION
AnAttributeRepository.AttributeKeythat can be set toBoolean.TRUEon theClientSessionto tell theSftpFileSystemthat it owns that session and should close it when theSftpFileSystemitself is closed. -
id
-
factory
-
selector
-
errorDataHandler
-
sftp
-
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:
providerin classBaseFileSystem<SftpPath>
-
getFileStores
- Overrides:
getFileStoresin classBaseFileSystem<SftpPath>
-
getReadBufferSize
public int getReadBufferSize() -
setReadBufferSize
public void setReadBufferSize(int size) -
getWriteBufferSize
public int getWriteBufferSize() -
setWriteBufferSize
public void setWriteBufferSize(int size) -
create
-
getClientSession
- Specified by:
getClientSessionin interfaceClientSessionHolder- Returns:
- The underlying
ClientSessionused
-
getSession
- Specified by:
getSessionin interfaceSessionHolder<ClientSession>
-
setClientSession
-
sessionForSftpClient
- Throws:
IOException
-
getClient
- Throws:
IOException
-
getClientInternal
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classFileSystem- Throws:
IOException
-
isOpen
public boolean isOpen()- Specified by:
isOpenin classFileSystem
-
supportedFileAttributeViews
- Specified by:
supportedFileAttributeViewsin classFileSystem
-
getUserPrincipalLookupService
- Specified by:
getUserPrincipalLookupServicein classFileSystem
-
getDefaultDir
- Overrides:
getDefaultDirin classBaseFileSystem<SftpPath>
-
toString
-