public interface ScpFileOpener
Modifier and Type | Method and Description |
---|---|
ScpSourceStreamResolver |
createScpSourceStreamResolver(java.nio.file.Path path) |
ScpTargetStreamResolver |
createScpTargetStreamResolver(java.nio.file.Path path) |
default java.nio.file.attribute.BasicFileAttributes |
getLocalBasicFileAttributes(java.nio.file.Path path,
java.nio.file.LinkOption... options) |
default java.util.Set<java.nio.file.attribute.PosixFilePermission> |
getLocalFilePermissions(java.nio.file.Path path,
java.nio.file.LinkOption... options) |
default java.nio.file.DirectoryStream<java.nio.file.Path> |
getLocalFolderChildren(java.nio.file.Path path)
Invoked when required to send all children of a local directory
|
default java.lang.Iterable<java.lang.String> |
getMatchingFilesToSend(java.lang.String basedir,
java.lang.String pattern)
Invoked when required to send a pattern of files
|
java.io.InputStream |
openRead(Session session,
java.nio.file.Path file,
java.nio.file.OpenOption... options)
Create an input stream to read from a file
|
java.io.OutputStream |
openWrite(Session session,
java.nio.file.Path file,
java.nio.file.OpenOption... options)
Create an output stream to write to a file
|
default java.nio.file.Path |
resolveIncomingFilePath(java.nio.file.Path localPath,
java.lang.String name,
boolean preserve,
java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions,
ScpTimestamp time)
Invoked when receiving a new file to via a directory command
|
default java.nio.file.Path |
resolveIncomingReceiveLocation(java.nio.file.Path path,
boolean recursive,
boolean shouldBeDir,
boolean preserve)
Invoked when a request to receive something is processed
|
default java.nio.file.Path |
resolveLocalPath(java.nio.file.FileSystem fileSystem,
java.lang.String commandPath) |
default java.nio.file.Path |
resolveOutgoingFilePath(java.nio.file.Path localPath,
java.nio.file.LinkOption... options)
Called when there is a candidate file/folder for sending
|
default boolean |
sendAsDirectory(java.nio.file.Path path,
java.nio.file.LinkOption... options)
Invoked on a local path in order to decide whether it should be sent
as a file or as a directory
|
default boolean |
sendAsRegularFile(java.nio.file.Path path,
java.nio.file.LinkOption... options)
Invoked on a local path in order to decide whether it should be sent
as a file or as a directory
|
static void |
updateFileProperties(java.nio.file.Path file,
java.util.Set<java.nio.file.attribute.PosixFilePermission> perms,
ScpTimestamp time) |
default java.nio.file.Path resolveIncomingFilePath(java.nio.file.Path localPath, java.lang.String name, boolean preserve, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, ScpTimestamp time) throws java.io.IOException
localPath
- The target local pathname
- The target file namepreserve
- Whether requested to preserve the permissions and timestamppermissions
- The requested file permissionstime
- The requested ScpTimestamp
- may be null
if nothing to updatejava.io.IOException
- If failed to resolve the file pathupdateFileProperties
default java.lang.Iterable<java.lang.String> getMatchingFilesToSend(java.lang.String basedir, java.lang.String pattern)
basedir
- The base directory - may be null
/empty to indicate CWDpattern
- The required patterndefault boolean sendAsRegularFile(java.nio.file.Path path, java.nio.file.LinkOption... options) throws java.io.IOException
path
- The local Path
options
- The LinkOption
-sfalse
then the sendAsDirectory(Path, LinkOption...)
is consulted.java.io.IOException
- If failed to decidedefault boolean sendAsDirectory(java.nio.file.Path path, java.nio.file.LinkOption... options) throws java.io.IOException
path
- The local Path
options
- The LinkOption
-strue
then getLocalFolderChildren(Path)
is consultedjava.io.IOException
- If failed to decidedefault java.nio.file.DirectoryStream<java.nio.file.Path> getLocalFolderChildren(java.nio.file.Path path) throws java.io.IOException
path
- The local folder Path
{DirectoryStream
of children to send - Note: for each child
the decision whether to send it as a file or a directory will be reached by consulting
the respective sendAsRegularFile
and
sendAsDirectory
methodsjava.io.IOException
- If failed to provide the children streamsendAsDirectory
default java.nio.file.attribute.BasicFileAttributes getLocalBasicFileAttributes(java.nio.file.Path path, java.nio.file.LinkOption... options) throws java.io.IOException
java.io.IOException
default java.util.Set<java.nio.file.attribute.PosixFilePermission> getLocalFilePermissions(java.nio.file.Path path, java.nio.file.LinkOption... options) throws java.io.IOException
java.io.IOException
default java.nio.file.Path resolveLocalPath(java.nio.file.FileSystem fileSystem, java.lang.String commandPath) throws java.io.IOException, java.nio.file.InvalidPathException
fileSystem
- The local FileSystem
on which local file should residecommandPath
- The command path using the local file separatorPath
java.io.IOException
- If failed to resolve the pathjava.nio.file.InvalidPathException
- If invalid local path valuedefault java.nio.file.Path resolveIncomingReceiveLocation(java.nio.file.Path path, boolean recursive, boolean shouldBeDir, boolean preserve) throws java.io.IOException
path
- The local target Path
of the requestrecursive
- Whether the request is recursiveshouldBeDir
- Whether target path is expected to be a directorypreserve
- Whether target path is expected to preserve attributes (permissions, times)java.io.IOException
- If failed to resolve target locationdefault java.nio.file.Path resolveOutgoingFilePath(java.nio.file.Path localPath, java.nio.file.LinkOption... options) throws java.io.IOException
localPath
- The original file/folder Path
for sendingoptions
- The LinkOption
-s to use for validationjava.io.IOException
- If failed to resolvejava.io.InputStream openRead(Session session, java.nio.file.Path file, java.nio.file.OpenOption... options) throws java.io.IOException
session
- The Session
requesting the accessfile
- The requested local file Path
options
- The OpenOption
s - may be null
/emptyInputStream
never null
java.io.IOException
- If failed to open the fileScpSourceStreamResolver createScpSourceStreamResolver(java.nio.file.Path path) throws java.io.IOException
java.io.IOException
java.io.OutputStream openWrite(Session session, java.nio.file.Path file, java.nio.file.OpenOption... options) throws java.io.IOException
session
- The Session
requesting the accessfile
- The requested local file Path
options
- The OpenOption
s - may be null
/emptyOutputStream
never null
java.io.IOException
- If failed to open the fileScpTargetStreamResolver createScpTargetStreamResolver(java.nio.file.Path path) throws java.io.IOException
java.io.IOException
static void updateFileProperties(java.nio.file.Path file, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms, ScpTimestamp time) throws java.io.IOException
java.io.IOException