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 String
private final InputStream
private final Path
private final String
private final Collection
<PosixFilePermission> private final long
private final ScpTimestampCommandDetails
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultScpStreamResolver
(String name, Path mockPath, Collection<PosixFilePermission> perms, ScpTimestampCommandDetails time, long size, InputStream local, String cmd) -
Method Summary
Modifier and TypeMethodDescriptionlong
getSize()
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, wait
Methods 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:
getFileName
in interfaceScpSourceStreamResolver
- Returns:
- The uploaded file name
- Throws:
IOException
- If failed to resolve the name
-
getEventListenerFilePath
- Specified by:
getEventListenerFilePath
in interfaceScpSourceStreamResolver
- Returns:
- The
Path
to use when invoking theScpTransferEventListener
-
getPermissions
- Specified by:
getPermissions
in interfaceScpSourceStreamResolver
- Returns:
- The permissions to be used for uploading a file
- Throws:
IOException
- If failed to generate the required permissions
-
getTimestamp
- Specified by:
getTimestamp
in interfaceScpSourceStreamResolver
- 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
- Specified by:
getSize
in 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:
resolveSourceStream
in interfaceScpSourceStreamResolver
- Parameters:
session
- TheSession
through which file is transmittedlength
- 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
-
toString
-