public class SftpFileSystemProvider extends FileSystemProvider
Modifier and Type | Field and Description |
---|---|
static String |
AUTH_TIME_PROP_NAME |
static String |
CONNECT_TIME_PROP_NAME |
static long |
DEFAULT_AUTH_TIME |
static long |
DEFAULT_CONNECT_TIME |
static int |
DEFAULT_READ_BUFFER_SIZE |
static int |
DEFAULT_WRITE_BUFFER_SIZE |
protected org.slf4j.Logger |
log |
static String |
READ_BUFFER_PROP_NAME |
static Set<Class<? extends FileAttributeView>> |
UNIVERSAL_SUPPORTED_VIEWS |
static String |
VERSION_PARAM
URI parameter that can be used to specify a special version selection.
|
static String |
WRITE_BUFFER_PROP_NAME |
Constructor and Description |
---|
SftpFileSystemProvider() |
SftpFileSystemProvider(SftpVersionSelector selector) |
SftpFileSystemProvider(SshClient client) |
SftpFileSystemProvider(SshClient client,
SftpVersionSelector selector) |
createLink, deleteIfExists, installedProviders, newAsynchronousFileChannel, newFileSystem, newInputStream, newOutputStream
public static final String READ_BUFFER_PROP_NAME
public static final int DEFAULT_READ_BUFFER_SIZE
public static final String WRITE_BUFFER_PROP_NAME
public static final int DEFAULT_WRITE_BUFFER_SIZE
public static final String CONNECT_TIME_PROP_NAME
public static final long DEFAULT_CONNECT_TIME
public static final String AUTH_TIME_PROP_NAME
public static final long DEFAULT_AUTH_TIME
public static final String VERSION_PARAM
URI parameter that can be used to specify a special version selection. Options are:
max
- select maximum available version for the clientmin
- select minimum available version for the clientcurrent
- whatever version is reported by the servernnn
- select only the specified versiona,b,c
- select one of the specified versions (if available) in preference orderpublic static final Set<Class<? extends FileAttributeView>> UNIVERSAL_SUPPORTED_VIEWS
protected final org.slf4j.Logger log
public SftpFileSystemProvider()
public SftpFileSystemProvider(SftpVersionSelector selector)
public SftpFileSystemProvider(SshClient client)
client
- The SshClient
to use - if null
then a
default one will be setup and started. Otherwise, it is assumed that
the client has already been startedSshClient.setUpDefaultClient()
public SftpFileSystemProvider(SshClient client, SftpVersionSelector selector)
public String getScheme()
getScheme
in class FileSystemProvider
public final SftpVersionSelector getSftpVersionSelector()
public SftpFileSystem newFileSystem(URI uri, Map<String,?> env) throws IOException
newFileSystem
in class FileSystemProvider
IOException
protected SftpVersionSelector resolveSftpVersionSelector(URI uri, SftpVersionSelector defaultSelector, PropertyResolver resolver)
public static Map<String,Object> resolveFileSystemParameters(Map<String,?> env, Map<String,Object> uriParams)
public SftpFileSystem newFileSystem(ClientSession session) throws IOException
IOException
public FileSystem getFileSystem(URI uri)
getFileSystem
in class FileSystemProvider
public SftpFileSystem removeFileSystem(String id)
id
- File system identifier - ignored if null
/emptySftpFileSystem
- null
if no matchpublic SftpFileSystem getFileSystem(String id)
id
- File system identifier - ignored if null
/emptySftpFileSystem
- null
if no matchpublic Path getPath(URI uri)
getPath
in class FileSystemProvider
public SeekableByteChannel newByteChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
newByteChannel
in class FileSystemProvider
IOException
public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException
newFileChannel
in class FileSystemProvider
IOException
public DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException
newDirectoryStream
in class FileSystemProvider
IOException
public void createDirectory(Path dir, FileAttribute<?>... attrs) throws IOException
createDirectory
in class FileSystemProvider
IOException
public void delete(Path path) throws IOException
delete
in class FileSystemProvider
IOException
public void copy(Path source, Path target, CopyOption... options) throws IOException
copy
in class FileSystemProvider
IOException
public void move(Path source, Path target, CopyOption... options) throws IOException
move
in class FileSystemProvider
IOException
public boolean isSameFile(Path path1, Path path2) throws IOException
isSameFile
in class FileSystemProvider
IOException
public boolean isHidden(Path path) throws IOException
isHidden
in class FileSystemProvider
IOException
public FileStore getFileStore(Path path) throws IOException
getFileStore
in class FileSystemProvider
IOException
public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws IOException
createSymbolicLink
in class FileSystemProvider
IOException
public Path readSymbolicLink(Path link) throws IOException
readSymbolicLink
in class FileSystemProvider
IOException
public void checkAccess(Path path, AccessMode... modes) throws IOException
checkAccess
in class FileSystemProvider
IOException
public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options)
getFileAttributeView
in class FileSystemProvider
public boolean isSupportedFileAttributeView(Path path, Class<? extends FileAttributeView> type)
public boolean isSupportedFileAttributeView(SftpFileSystem fs, Class<? extends FileAttributeView> type)
public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws IOException
readAttributes
in class FileSystemProvider
IOException
public Map<String,Object> readAttributes(Path path, String attributes, LinkOption... options) throws IOException
readAttributes
in class FileSystemProvider
IOException
public Map<String,Object> readAttributes(Path path, String view, String attrs, LinkOption... options) throws IOException
IOException
protected Map<String,Object> readCustomViewAttributes(SftpPath path, String view, String attrs, LinkOption... options) throws IOException
IOException
protected Map<String,Object> readAclViewAttributes(SftpPath path, String view, String attrs, LinkOption... options) throws IOException
IOException
protected SftpClient.Attributes readRemoteAttributes(SftpPath path, LinkOption... options) throws IOException
IOException
protected Map<String,Object> readPosixViewAttributes(SftpPath path, String view, String attrs, LinkOption... options) throws IOException
IOException
public void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws IOException
setAttribute
in class FileSystemProvider
IOException
public void setAttribute(Path path, String view, String attr, Object value, LinkOption... options) throws IOException
IOException
protected int attributesToPermissions(Path path, Collection<PosixFilePermission> perms)
public static String getRWXPermissions(int perms)
public static String getOctalPermissions(int perms)
public static Set<PosixFilePermission> permissionsToAttributes(int perms)
public static String getOctalPermissions(Collection<PosixFilePermission> perms)
public static String getFileSystemIdentifier(URI uri)
uri
- The URI
- Note: not checked to make sure
that the scheme is sftp://
getFileSystemIdentifier(String, int, String)
public static String getFileSystemIdentifier(ClientSession session)
session
- The ClientSession
getFileSystemIdentifier(String, int, String)
public static String getFileSystemIdentifier(String host, int port, String username)
public static URI createFileSystemURI(String host, int port, String username, String password)
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.