public interface SftpFileSystemAccessor
Modifier and Type | Field and Description |
---|---|
static SftpFileSystemAccessor |
DEFAULT |
static java.util.List<java.lang.String> |
DEFAULT_UNIX_VIEW |
static java.util.NavigableMap<java.lang.String,FileInfoExtractor<?>> |
FILEATTRS_RESOLVERS
A case insensitive
NavigableMap of FileInfoExtractor s to
be used to complete attributes that are deemed important enough to warrant an
extra effort if not accessible via the file system attributes views |
Modifier and Type | Method and Description |
---|---|
default java.nio.file.DirectoryStream<java.nio.file.Path> |
openDirectory(ServerSession session,
SftpEventListenerManager subsystem,
java.nio.file.Path dir,
java.lang.String handle)
Called when a new directory stream is requested
|
default java.nio.channels.SeekableByteChannel |
openFile(ServerSession session,
SftpEventListenerManager subsystem,
java.nio.file.Path file,
java.lang.String handle,
java.util.Set<? extends java.nio.file.OpenOption> options,
java.nio.file.attribute.FileAttribute<?>... attrs)
Called whenever a new file is opened
|
default void |
syncFileData(ServerSession session,
SftpEventListenerManager subsystem,
java.nio.file.Path file,
java.lang.String handle,
java.nio.channels.Channel channel)
Called when file meta-data re-synchronization is required
|
default java.nio.channels.FileLock |
tryLock(ServerSession session,
SftpEventListenerManager subsystem,
java.nio.file.Path file,
java.lang.String handle,
java.nio.channels.Channel channel,
long position,
long size,
boolean shared)
Called when locking a section of a file is requested
|
static final java.util.List<java.lang.String> DEFAULT_UNIX_VIEW
static final java.util.NavigableMap<java.lang.String,FileInfoExtractor<?>> FILEATTRS_RESOLVERS
NavigableMap
of FileInfoExtractor
s to
be used to complete attributes that are deemed important enough to warrant an
extra effort if not accessible via the file system attributes viewsstatic final SftpFileSystemAccessor DEFAULT
default java.nio.channels.SeekableByteChannel openFile(ServerSession session, SftpEventListenerManager subsystem, java.nio.file.Path file, java.lang.String handle, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs) throws java.io.IOException
session
- The ServerSession
through which the request was receivedsubsystem
- The SFTP subsystem instance that manages the sessionfile
- The requested local file Path
handle
- The assigned file handle through which the remote peer references this file.
May be null
/empty if the request is due to some internal functionality
instead of due to peer requesting a handle to a file.options
- The requested OpenOption
sattrs
- The requested FileAttribute
sSeekableByteChannel
java.io.IOException
- If failed to opendefault java.nio.channels.FileLock tryLock(ServerSession session, SftpEventListenerManager subsystem, java.nio.file.Path file, java.lang.String handle, java.nio.channels.Channel channel, long position, long size, boolean shared) throws java.io.IOException
session
- The ServerSession
through which the request was receivedsubsystem
- The SFTP subsystem instance that manages the sessionfile
- The requested local file Path
handle
- The assigned file handle through which the remote peer references this filechannel
- The original Channel
that was returned by openFile(ServerSession, SftpEventListenerManager, Path, String, Set, FileAttribute...)
position
- The position at which the locked region is to start - must be non-negativesize
- The size of the locked region; must be non-negative, and the sum
position + size must be non-negativeshared
- true
to request a shared lock, false
to request an exclusive locknull
if the lock could not be acquired because another program holds an overlapping lockjava.io.IOException
- If failed to honor the requestFileChannel.tryLock(long, long, boolean)
default void syncFileData(ServerSession session, SftpEventListenerManager subsystem, java.nio.file.Path file, java.lang.String handle, java.nio.channels.Channel channel) throws java.io.IOException
session
- The ServerSession
through which the request was receivedsubsystem
- The SFTP subsystem instance that manages the sessionfile
- The requested local file Path
handle
- The assigned file handle through which the remote peer references this filechannel
- The original Channel
that was returned by openFile(ServerSession, SftpEventListenerManager, Path, String, Set, FileAttribute...)
java.io.IOException
- If failed to execute the requestFileChannel.force(boolean)
,
OpenSSH - section 10default java.nio.file.DirectoryStream<java.nio.file.Path> openDirectory(ServerSession session, SftpEventListenerManager subsystem, java.nio.file.Path dir, java.lang.String handle) throws java.io.IOException
session
- The ServerSession
through which the request was receivedsubsystem
- The SFTP subsystem instance that manages the sessiondir
- The requested local directoryhandle
- The assigned directory handle through which the remote peer references this directoryDirectoryStream
java.io.IOException
- If failed to open