public interface ScpFileOpener
Modifier and Type | Method and Description |
---|---|
default void |
closeRead(Session session,
Path file,
long size,
Set<PosixFilePermission> permissions,
InputStream stream)
Called when the stream obtained from
openRead is no
longer required since data has been successfully copied. |
default void |
closeWrite(Session session,
Path file,
long size,
Set<PosixFilePermission> permissions,
OutputStream os)
Called when output stream obtained from
openWrite is
no longer needed since data copying has been successfully completed. |
ScpSourceStreamResolver |
createScpSourceStreamResolver(Session session,
Path path) |
ScpTargetStreamResolver |
createScpTargetStreamResolver(Session session,
Path path) |
default BasicFileAttributes |
getLocalBasicFileAttributes(Session session,
Path path,
LinkOption... options) |
default Set<PosixFilePermission> |
getLocalFilePermissions(Session session,
Path path,
LinkOption... options) |
default DirectoryStream<Path> |
getLocalFolderChildren(Session session,
Path path)
Invoked when required to send all children of a local directory
|
default Iterable<Path> |
getMatchingFilesToSend(Session session,
Path basedir,
String pattern)
Invoked when required to send a pattern of files
|
InputStream |
openRead(Session session,
Path file,
long size,
Set<PosixFilePermission> permissions,
OpenOption... options)
Create an input stream to read from a file
|
OutputStream |
openWrite(Session session,
Path file,
long size,
Set<PosixFilePermission> permissions,
OpenOption... options)
Create an output stream to write to a file
|
default Path |
resolveIncomingFilePath(Session session,
Path localPath,
String name,
boolean preserve,
Set<PosixFilePermission> permissions,
ScpTimestampCommandDetails time)
Invoked when receiving a new file to via a directory command
|
default Path |
resolveIncomingReceiveLocation(Session session,
Path path,
boolean recursive,
boolean shouldBeDir,
boolean preserve)
Invoked when a request to receive something is processed
|
default Path |
resolveLocalPath(Session session,
FileSystem fileSystem,
String commandPath) |
default Path |
resolveOutgoingFilePath(Session session,
Path localPath,
LinkOption... options)
Called when there is a candidate file/folder for sending
|
default boolean |
sendAsDirectory(Session session,
Path path,
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(Session session,
Path path,
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(Path file,
Set<PosixFilePermission> perms,
ScpTimestampCommandDetails time) |
default Path resolveIncomingFilePath(Session session, Path localPath, String name, boolean preserve, Set<PosixFilePermission> permissions, ScpTimestampCommandDetails time) throws IOException
session
- The client/server Session
through which the transfer is being executedlocalPath
- The target local pathname
- The target file namepreserve
- Whether requested to preserve the permissions and timestamppermissions
- The requested file permissionstime
- The requested ScpTimestampCommandDetails
- may be null
if nothing to updateIOException
- If failed to resolve the file pathupdateFileProperties
default Iterable<Path> getMatchingFilesToSend(Session session, Path basedir, String pattern) throws IOException
session
- The client/server Session
through which the transfer is being executedbasedir
- The base directory - may be null
/empty to indicate CWDpattern
- The required pattern - ignored if null
/empty - returns empty resultIOException
- If failed to scan the directorydefault boolean sendAsRegularFile(Session session, Path path, LinkOption... options) throws IOException
session
- The client/server Session
through which the transfer is being executedpath
- The local Path
options
- The LinkOption
-sfalse
then the
sendAsDirectory(Session, Path, LinkOption...)
is consulted.IOException
- If failed to decidedefault boolean sendAsDirectory(Session session, Path path, LinkOption... options) throws IOException
session
- The client/server Session
through which the transfer is being executedpath
- The local Path
options
- The LinkOption
-strue
then
getLocalFolderChildren(Session, Path)
is consultedIOException
- If failed to decidedefault DirectoryStream<Path> getLocalFolderChildren(Session session, Path path) throws IOException
session
- The client/server Session
through which the transfer is being executedpath
- 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
methodsIOException
- If failed to provide the children streamsendAsDirectory
default BasicFileAttributes getLocalBasicFileAttributes(Session session, Path path, LinkOption... options) throws IOException
IOException
default Set<PosixFilePermission> getLocalFilePermissions(Session session, Path path, LinkOption... options) throws IOException
IOException
default Path resolveLocalPath(Session session, FileSystem fileSystem, String commandPath) throws IOException, InvalidPathException
session
- The client/server Session
through which the transfer is being executedfileSystem
- The local FileSystem
on which local file should residecommandPath
- The command path using the local file separatorPath
IOException
- If failed to resolve the pathInvalidPathException
- If invalid local path valuedefault Path resolveIncomingReceiveLocation(Session session, Path path, boolean recursive, boolean shouldBeDir, boolean preserve) throws IOException
session
- The client/server Session
through which the transfer is being executedpath
- 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)IOException
- If failed to resolve target locationdefault Path resolveOutgoingFilePath(Session session, Path localPath, LinkOption... options) throws IOException
session
- The client/server Session
through which the transfer is being executedlocalPath
- The original file/folder Path
for sendingoptions
- The LinkOption
-s to use for validationIOException
- If failed to resolveInputStream openRead(Session session, Path file, long size, Set<PosixFilePermission> permissions, OpenOption... options) throws IOException
session
- The Session
requesting the accessfile
- The requested local file Path
size
- The expected transfer bytes countpermissions
- The requested file permissionsoptions
- The OpenOption
s - may be null
/emptyInputStream
never null
IOException
- If failed to open the filedefault void closeRead(Session session, Path file, long size, Set<PosixFilePermission> permissions, InputStream stream) throws IOException
openRead
is no
longer required since data has been successfully copied.session
- The Session
requesting the accessfile
- The requested local file Path
size
- The expected transfer bytes countpermissions
- The requested file permissionsstream
- The InputStream
to closeIOException
- If failed to close the stream - Note: stream will be closed regardless of whether this
method throws an exception or not.ScpSourceStreamResolver createScpSourceStreamResolver(Session session, Path path) throws IOException
IOException
OutputStream openWrite(Session session, Path file, long size, Set<PosixFilePermission> permissions, OpenOption... options) throws IOException
session
- The Session
requesting the accessfile
- The requested local file Path
size
- The expected transfer byte countpermissions
- The requested file permissionsoptions
- The OpenOption
s - may be null
/emptyOutputStream
never null
IOException
- If failed to open the filedefault void closeWrite(Session session, Path file, long size, Set<PosixFilePermission> permissions, OutputStream os) throws IOException
openWrite
is
no longer needed since data copying has been successfully completed.session
- The Session
requesting the accessfile
- The requested local file Path
size
- The expected transfer byte countpermissions
- The requested file permissionsos
- The opened OutputStream
IOException
- If failed to close the stream - Note: stream will be closed regardless of whether this
method throws an exception or not.ScpTargetStreamResolver createScpTargetStreamResolver(Session session, Path path) throws IOException
IOException
static void updateFileProperties(Path file, Set<PosixFilePermission> perms, ScpTimestampCommandDetails time) throws IOException
IOException
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.