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.Stringcmdprivate java.io.InputStreamlocalprivate java.nio.file.PathmockPathprivate java.lang.Stringnameprivate java.util.Collection<java.nio.file.attribute.PosixFilePermission>permsprivate longsizeprivate ScpTimestampCommandDetailstime
-
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.PathgetEventListenerFilePath()java.lang.StringgetFileName()java.util.Collection<java.nio.file.attribute.PosixFilePermission>getPermissions()longgetSize()ScpTimestampCommandDetailsgetTimestamp()java.io.InputStreamresolveSourceStream(Session session, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.nio.file.OpenOption... options)java.lang.StringtoString()-
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:
getFileNamein 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:
getEventListenerFilePathin interfaceScpSourceStreamResolver- Returns:
- The
Pathto use when invoking theScpTransferEventListener
-
getPermissions
public java.util.Collection<java.nio.file.attribute.PosixFilePermission> getPermissions() throws java.io.IOException- Specified by:
getPermissionsin 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:
getTimestampin interfaceScpSourceStreamResolver- Returns:
- The
ScpTimestampCommandDetailsto use for uploading the file ifnullthen 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:
getSizein 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:
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:
java.io.IOException- If failed to create the stream
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-