Package org.apache.sshd.scp.common
Interface ScpSourceStreamResolver
- All Known Implementing Classes:
DefaultScpStreamResolver,LocalFileScpSourceStreamResolver
public interface ScpSourceStreamResolver
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidcloseSourceStream(Session session, long fileSize, Set<PosixFilePermission> permissions, InputStream stream) Called when the stream obtained fromresolveSourceStreamis no longer needed since since file copy was completed successfully.longgetSize()resolveSourceStream(Session session, long fileSize, Set<PosixFilePermission> permissions, OpenOption... options)
-
Method Details
-
getFileName
- Returns:
- The uploaded file name
- Throws:
IOException- If failed to resolve the name
-
getEventListenerFilePath
Path getEventListenerFilePath()- Returns:
- The
Pathto use when invoking theScpTransferEventListener
-
getPermissions
- Returns:
- The permissions to be used for uploading a file
- Throws:
IOException- If failed to generate the required permissions
-
getTimestamp
- Returns:
- The
ScpTimestampCommandDetailsto use for uploading the file ifnullthen no need to send this information - Throws:
IOException- If failed to generate the required data
-
getSize
- Returns:
- An estimated size of the expected number of bytes to be uploaded. If non-positive then assumed to be unknown.
- Throws:
IOException- If failed to generate an estimate
-
resolveSourceStream
InputStream resolveSourceStream(Session session, long fileSize, Set<PosixFilePermission> permissions, OpenOption... options) throws IOException - Parameters:
session- TheSessionthrough which file is transmittedfileSize- The expected transfer byte countpermissions- The requested file permissionsoptions- TheOpenOptions may benull/empty- Returns:
- The
InputStreamcontaining the data to be uploaded - Throws:
IOException- If failed to create the stream
-
closeSourceStream
default void closeSourceStream(Session session, long fileSize, Set<PosixFilePermission> permissions, InputStream stream) throws IOException Called when the stream obtained fromresolveSourceStreamis no longer needed since since file copy was completed successfully.- Parameters:
session- TheSessionthrough which file is transmittedfileSize- The expected transfer byte countpermissions- The requested file permissionsstream- TheInputStreamto close- Throws:
IOException- If failed to close the stream - Note: stream will be closed regardless of whether this method throws an exception or not.
-