public interface ScpFileOpener
| Modifier and Type | Method and Description |
|---|---|
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<String> |
getMatchingFilesToSend(Session session,
String 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,
ScpTimestamp 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,
ScpTimestamp time) |
default Path resolveIncomingFilePath(Session session, Path localPath, String name, boolean preserve, Set<PosixFilePermission> permissions, ScpTimestamp 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 ScpTimestamp - may be null if nothing to updateIOException - If failed to resolve the file pathupdateFilePropertiesdefault Iterable<String> getMatchingFilesToSend(Session session, String basedir, String pattern)
session - The client/server Session through which the transfer is being executedbasedir - The base directory - may be null/empty to indicate CWDpattern - The required patterndefault boolean sendAsRegularFile(Session session, Path path, LinkOption... options) throws IOException
session - The client/server Session through which the transfer is being executedpath - The local Pathoptions - 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 Pathoptions - 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 PathDirectoryStream 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 streamsendAsDirectorydefault BasicFileAttributes getLocalBasicFileAttributes(Session session, Path path, LinkOption... options) throws IOException
IOExceptiondefault Set<PosixFilePermission> getLocalFilePermissions(Session session, Path path, LinkOption... options) throws IOException
IOExceptiondefault 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 separatorPathIOException - 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 Pathsize - The expected transfer bytes countpermissions - The requested file permissionsoptions - The OpenOptions - may be null/emptyInputStream never nullIOException - If failed to open the fileScpSourceStreamResolver createScpSourceStreamResolver(Session session, Path path) throws IOException
IOExceptionOutputStream openWrite(Session session, Path file, long size, Set<PosixFilePermission> permissions, OpenOption... options) throws IOException
session - The Session requesting the accessfile - The requested local file Pathsize - The expected transfer byte countpermissions - The requested file permissionsoptions - The OpenOptions - may be null/emptyOutputStream never nullIOException - If failed to open the fileScpTargetStreamResolver createScpTargetStreamResolver(Session session, Path path) throws IOException
IOExceptionstatic void updateFileProperties(Path file, Set<PosixFilePermission> perms, ScpTimestamp time) throws IOException
IOExceptionCopyright © 2018–2019 The Apache Software Foundation. All rights reserved.