Class SftpFileSystem
java.lang.Object
org.apache.commons.vfs2.provider.AbstractVfsComponent
org.apache.commons.vfs2.provider.AbstractFileSystem
org.apache.commons.vfs2.provider.sftp.SftpFileSystem
- All Implemented Interfaces:
FileSystem
,VfsComponent
Represents the files on an SFTP server.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SftpFileSystem
(GenericFileName rootName, com.jcraft.jsch.Session session, FileSystemOptions fileSystemOptions) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCapabilities
(Collection<Capability> caps) Adds the capabilities of this file system.protected FileObject
createFile
(AbstractFileName name) Creates a file object.protected void
Close the underlying link used to access the filesprotected com.jcraft.jsch.ChannelSftp
Returns an SFTP channel to the server.int[]
Gets the (numeric) group IDs.double
Last modification time is only an int and in seconds, thus can be off by 999.int
getUId()
Get the (numeric) group IDs.protected void
putChannel
(com.jcraft.jsch.ChannelSftp channel) Returns a channel to the pool.Methods inherited from class org.apache.commons.vfs2.provider.AbstractFileSystem
addJunction, addListener, close, closeCommunicationLink, decorateFileObject, doReplicateFile, fireFileChanged, fireFileCreated, fireFileDeleted, getAttribute, getFileFromCache, getFileSystemManager, getFileSystemOptions, getParentLayer, getRoot, getRootName, getRootURI, hasCapability, init, isOpen, isReleaseable, notifyAllStreamsClosed, putFileToCache, removeFileFromCache, removeJunction, removeListener, replicateFile, resolveFile, resolveFile, setAttribute
Methods inherited from class org.apache.commons.vfs2.provider.AbstractVfsComponent
getContext, getLogger, setContext, setLogger
-
Constructor Details
-
SftpFileSystem
protected SftpFileSystem(GenericFileName rootName, com.jcraft.jsch.Session session, FileSystemOptions fileSystemOptions)
-
-
Method Details
-
doCloseCommunicationLink
Description copied from class:AbstractFileSystem
Close the underlying link used to access the files- Overrides:
doCloseCommunicationLink
in classAbstractFileSystem
-
getChannel
Returns an SFTP channel to the server.- Returns:
- new or reused channel, never null.
- Throws:
FileSystemException
- if a session cannot be created.IOException
- if an I/O error is detected.
-
putChannel
Returns a channel to the pool.- Parameters:
channel
- the used channel.
-
addCapabilities
Adds the capabilities of this file system.- Specified by:
addCapabilities
in classAbstractFileSystem
- Parameters:
caps
- collections of Capabilities, can be immutable.
-
createFile
Creates a file object. This method is called only if the requested file is not cached.- Specified by:
createFile
in classAbstractFileSystem
- Parameters:
name
- name referencing the new file.- Returns:
- new created FileObject.
- Throws:
FileSystemException
-
getLastModTimeAccuracy
Last modification time is only an int and in seconds, thus can be off by 999.- Specified by:
getLastModTimeAccuracy
in interfaceFileSystem
- Overrides:
getLastModTimeAccuracy
in classAbstractFileSystem
- Returns:
- 1000
-
getGroupsIds
Gets the (numeric) group IDs.- Returns:
- the (numeric) group IDs.
- Throws:
com.jcraft.jsch.JSchException
- If a problem occurs while retrieving the group IDs.IOException
- if an I/O error is detected.- Since:
- 2.1
-
getUId
Get the (numeric) group IDs.- Returns:
- The numeric user ID
- Throws:
com.jcraft.jsch.JSchException
- If a problem occurs while retrieving the group ID.IOException
- if an I/O error is detected.- Since:
- 2.1
-