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 Object implements ScpSourceStreamResolver
- Author:
- Apache MINA SSHD Project
-
-
Constructor Summary
Constructors Constructor Description DefaultScpStreamResolver(String name, Path mockPath, Collection<PosixFilePermission> perms, ScpTimestampCommandDetails time, long size, InputStream local, String cmd)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Path
getEventListenerFilePath()
String
getFileName()
Collection<PosixFilePermission>
getPermissions()
long
getSize()
ScpTimestampCommandDetails
getTimestamp()
InputStream
resolveSourceStream(Session session, long length, Set<PosixFilePermission> permissions, OpenOption... options)
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
-
-
-
-
Constructor Detail
-
DefaultScpStreamResolver
public DefaultScpStreamResolver(String name, Path mockPath, Collection<PosixFilePermission> perms, ScpTimestampCommandDetails time, long size, InputStream local, String cmd)
-
-
Method Detail
-
getFileName
public String getFileName() throws IOException
- Specified by:
getFileName
in interfaceScpSourceStreamResolver
- Returns:
- The uploaded file name
- Throws:
IOException
- If failed to resolve the name
-
getEventListenerFilePath
public Path getEventListenerFilePath()
- Specified by:
getEventListenerFilePath
in interfaceScpSourceStreamResolver
- Returns:
- The
Path
to use when invoking theScpTransferEventListener
-
getPermissions
public Collection<PosixFilePermission> getPermissions() throws IOException
- 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
public ScpTimestampCommandDetails getTimestamp() throws IOException
- 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
public long getSize() throws 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:
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
-
-