Package org.apache.sshd.scp.common
Interface ScpSourceStreamResolver
-
- All Known Implementing Classes:
DefaultScpStreamResolver,LocalFileScpSourceStreamResolver
public interface ScpSourceStreamResolver
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidcloseSourceStream(Session session, long fileSize, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.io.InputStream stream)Called when the stream obtained fromresolveSourceStreamis no longer needed since since file copy was completed successfully.java.nio.file.PathgetEventListenerFilePath()java.lang.StringgetFileName()java.util.Collection<java.nio.file.attribute.PosixFilePermission>getPermissions()longgetSize()ScpTimestampCommandDetailsgetTimestamp()java.io.InputStreamresolveSourceStream(Session session, long fileSize, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.nio.file.OpenOption... options)
-
-
-
Method Detail
-
getFileName
java.lang.String getFileName() throws java.io.IOException- Returns:
- The uploaded file name
- Throws:
java.io.IOException- If failed to resolve the name
-
getEventListenerFilePath
java.nio.file.Path getEventListenerFilePath()
- Returns:
- The
Pathto use when invoking theScpTransferEventListener
-
getPermissions
java.util.Collection<java.nio.file.attribute.PosixFilePermission> getPermissions() throws java.io.IOException- Returns:
- The permissions to be used for uploading a file
- Throws:
java.io.IOException- If failed to generate the required permissions
-
getTimestamp
ScpTimestampCommandDetails getTimestamp() throws java.io.IOException
- Returns:
- The
ScpTimestampCommandDetailsto use for uploading the file ifnullthen no need to send this information - Throws:
java.io.IOException- If failed to generate the required data
-
getSize
long getSize() throws java.io.IOException- Returns:
- An estimated size of the expected number of bytes to be uploaded. If non-positive then assumed to be unknown.
- Throws:
java.io.IOException- If failed to generate an estimate
-
resolveSourceStream
java.io.InputStream resolveSourceStream(Session session, long fileSize, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.nio.file.OpenOption... options) throws java.io.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:
java.io.IOException- If failed to create the stream
-
closeSourceStream
default void closeSourceStream(Session session, long fileSize, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.io.InputStream stream) throws java.io.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:
java.io.IOException- If failed to close the stream - Note: stream will be closed regardless of whether this method throws an exception or not.
-
-