Package org.apache.sshd.scp.common
Interface ScpSourceStreamResolver
-
- All Known Implementing Classes:
DefaultScpStreamResolver,LocalFileScpSourceStreamResolver
public interface ScpSourceStreamResolver- Author:
- Apache MINA SSHD Project
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default 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.PathgetEventListenerFilePath()StringgetFileName()Collection<PosixFilePermission>getPermissions()longgetSize()ScpTimestampCommandDetailsgetTimestamp()InputStreamresolveSourceStream(Session session, long fileSize, Set<PosixFilePermission> permissions, OpenOption... options)
-
-
-
Method Detail
-
getFileName
String getFileName() throws IOException
- Returns:
- The uploaded file name
- Throws:
IOException- If failed to resolve the name
-
getEventListenerFilePath
Path getEventListenerFilePath()
- Returns:
- The
Pathto use when invoking theScpTransferEventListener
-
getPermissions
Collection<PosixFilePermission> getPermissions() throws IOException
- Returns:
- The permissions to be used for uploading a file
- Throws:
IOException- If failed to generate the required permissions
-
getTimestamp
ScpTimestampCommandDetails getTimestamp() throws IOException
- 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
long getSize() throws IOException- 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.
-
-