Package org.apache.sshd.common.scp
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 void
closeSourceStream(Session session, long fileSize, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.io.InputStream stream)
Called when the stream obtained fromresolveSourceStream
is no longer needed since since file copy was completed successfully.java.nio.file.Path
getEventListenerFilePath()
java.lang.String
getFileName()
java.util.Collection<java.nio.file.attribute.PosixFilePermission>
getPermissions()
long
getSize()
ScpTimestamp
getTimestamp()
java.io.InputStream
resolveSourceStream(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
Path
to 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
ScpTimestamp getTimestamp() throws java.io.IOException
- Returns:
- The
ScpTimestamp
to use for uploading the file ifnull
then 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
- 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:
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 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:
java.io.IOException
- If failed to close the stream - Note: stream will be closed regardless of whether this method throws an exception or not.
-
-