Package org.apache.sshd.scp.client
Class DefaultScpStreamResolver
- java.lang.Object
-
- org.apache.sshd.scp.client.DefaultScpStreamResolver
-
- All Implemented Interfaces:
ScpSourceStreamResolver
public class DefaultScpStreamResolver extends java.lang.Object implements ScpSourceStreamResolver
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
cmd
private java.io.InputStream
local
private java.nio.file.Path
mockPath
private java.lang.String
name
private java.util.Collection<java.nio.file.attribute.PosixFilePermission>
perms
private long
size
private ScpTimestampCommandDetails
time
-
Constructor Summary
Constructors Constructor Description DefaultScpStreamResolver(java.lang.String name, java.nio.file.Path mockPath, java.util.Collection<java.nio.file.attribute.PosixFilePermission> perms, ScpTimestampCommandDetails time, long size, java.io.InputStream local, java.lang.String cmd)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.file.Path
getEventListenerFilePath()
java.lang.String
getFileName()
java.util.Collection<java.nio.file.attribute.PosixFilePermission>
getPermissions()
long
getSize()
ScpTimestampCommandDetails
getTimestamp()
java.io.InputStream
resolveSourceStream(Session session, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.nio.file.OpenOption... options)
java.lang.String
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 Detail
-
name
private final java.lang.String name
-
mockPath
private final java.nio.file.Path mockPath
-
perms
private final java.util.Collection<java.nio.file.attribute.PosixFilePermission> perms
-
time
private final ScpTimestampCommandDetails time
-
size
private final long size
-
local
private final java.io.InputStream local
-
cmd
private final java.lang.String cmd
-
-
Constructor Detail
-
DefaultScpStreamResolver
public DefaultScpStreamResolver(java.lang.String name, java.nio.file.Path mockPath, java.util.Collection<java.nio.file.attribute.PosixFilePermission> perms, ScpTimestampCommandDetails time, long size, java.io.InputStream local, java.lang.String cmd)
-
-
Method Detail
-
getFileName
public java.lang.String getFileName() throws java.io.IOException
- Specified by:
getFileName
in interfaceScpSourceStreamResolver
- Returns:
- The uploaded file name
- Throws:
java.io.IOException
- If failed to resolve the name
-
getEventListenerFilePath
public java.nio.file.Path getEventListenerFilePath()
- Specified by:
getEventListenerFilePath
in interfaceScpSourceStreamResolver
- Returns:
- The
Path
to use when invoking theScpTransferEventListener
-
getPermissions
public java.util.Collection<java.nio.file.attribute.PosixFilePermission> getPermissions() throws java.io.IOException
- Specified by:
getPermissions
in interfaceScpSourceStreamResolver
- Returns:
- The permissions to be used for uploading a file
- Throws:
java.io.IOException
- If failed to generate the required permissions
-
getTimestamp
public ScpTimestampCommandDetails getTimestamp() throws java.io.IOException
- Specified by:
getTimestamp
in interfaceScpSourceStreamResolver
- Returns:
- The
ScpTimestampCommandDetails
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
public long getSize() throws java.io.IOException
- 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:
java.io.IOException
- If failed to generate an estimate
-
resolveSourceStream
public java.io.InputStream resolveSourceStream(Session session, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.nio.file.OpenOption... options) throws java.io.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:
java.io.IOException
- If failed to create the stream
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-