Package org.apache.sshd.scp.client
Class DefaultScpStreamResolver
java.lang.Object
org.apache.sshd.scp.client.DefaultScpStreamResolver
- All Implemented Interfaces:
ScpSourceStreamResolver
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final InputStreamprivate final Pathprivate final Stringprivate final Collection<PosixFilePermission> private final longprivate final ScpTimestampCommandDetails -
Constructor Summary
ConstructorsConstructorDescriptionDefaultScpStreamResolver(String name, Path mockPath, Collection<PosixFilePermission> perms, ScpTimestampCommandDetails time, long size, InputStream local, String cmd) -
Method Summary
Modifier and TypeMethodDescriptionlonggetSize()resolveSourceStream(Session session, long length, Set<PosixFilePermission> permissions, OpenOption... options) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.scp.common.ScpSourceStreamResolver
closeSourceStream
-
Field Details
-
name
-
mockPath
-
perms
-
time
-
size
private final long size -
local
-
cmd
-
-
Constructor Details
-
DefaultScpStreamResolver
public DefaultScpStreamResolver(String name, Path mockPath, Collection<PosixFilePermission> perms, ScpTimestampCommandDetails time, long size, InputStream local, String cmd)
-
-
Method Details
-
getFileName
- Specified by:
getFileNamein interfaceScpSourceStreamResolver- Returns:
- The uploaded file name
- Throws:
IOException- If failed to resolve the name
-
getEventListenerFilePath
- Specified by:
getEventListenerFilePathin interfaceScpSourceStreamResolver- Returns:
- The
Pathto use when invoking theScpTransferEventListener
-
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
-
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
-
toString
-