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 void
closeSourceStream(Session session, long fileSize, Set<PosixFilePermission> permissions, InputStream stream)
Called when the stream obtained fromresolveSourceStream
is no longer needed since since file copy was completed successfully.Path
getEventListenerFilePath()
String
getFileName()
Collection<PosixFilePermission>
getPermissions()
long
getSize()
ScpTimestampCommandDetails
getTimestamp()
InputStream
resolveSourceStream(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
Path
to 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
ScpTimestampCommandDetails
to use for uploading the file ifnull
then 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
- TheSession
through which file is transmittedfileSize
- The expected transfer byte countpermissions
- The requested file permissionsoptions
- TheOpenOption
s may benull
/empty- Returns:
- The
InputStream
containing 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 fromresolveSourceStream
is no longer needed since since file copy was completed successfully.- Parameters:
session
- TheSession
through which file is transmittedfileSize
- The expected transfer byte countpermissions
- The requested file permissionsstream
- TheInputStream
to close- Throws:
IOException
- If failed to close the stream - Note: stream will be closed regardless of whether this method throws an exception or not.
-
-