Class LocalFileScpSourceStreamResolver
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.scp.common.helpers.LocalFileScpSourceStreamResolver
- All Implemented Interfaces:
ScpSourceStreamResolver
public class LocalFileScpSourceStreamResolver
extends AbstractLoggingBean
implements ScpSourceStreamResolver
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Pathprotected final ScpFileOpenerprotected final Pathprotected final Set<PosixFilePermission> protected final longprotected final ScpTimestampCommandDetailsFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseSourceStream(Session session, long length, 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 length, Set<PosixFilePermission> permissions, OpenOption... options) toString()
-
Field Details
-
path
-
opener
-
name
-
perms
-
size
protected final long size -
time
-
-
Constructor Details
-
LocalFileScpSourceStreamResolver
- Throws:
IOException
-
-
Method Details
-
getFileName
- Specified by:
getFileNamein interfaceScpSourceStreamResolver- Returns:
- The uploaded file name
- Throws:
IOException- If failed to resolve the name
-
getPermissions
- Specified by:
getPermissionsin interfaceScpSourceStreamResolver- Returns:
- The permissions to be used for uploading a file
- Throws:
IOException- If failed to generate the required permissions
-
getTimestamp
- Specified by:
getTimestampin interfaceScpSourceStreamResolver- 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
- Specified by:
getSizein interfaceScpSourceStreamResolver- 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
-
getEventListenerFilePath
- Specified by:
getEventListenerFilePathin interfaceScpSourceStreamResolver- Returns:
- The
Pathto use when invoking theScpTransferEventListener
-
resolveSourceStream
public InputStream resolveSourceStream(Session session, long length, Set<PosixFilePermission> permissions, OpenOption... options) throws IOException - Specified by:
resolveSourceStreamin interfaceScpSourceStreamResolver- Parameters:
session- TheSessionthrough which file is transmittedlength- 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
public void closeSourceStream(Session session, long length, Set<PosixFilePermission> permissions, InputStream stream) throws IOException Description copied from interface:ScpSourceStreamResolverCalled when the stream obtained fromresolveSourceStreamis no longer needed since since file copy was completed successfully.- Specified by:
closeSourceStreamin interfaceScpSourceStreamResolver- Parameters:
session- TheSessionthrough which file is transmittedlength- 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.
-
toString
-