public class LocalFileScpSourceStreamResolver extends AbstractLoggingBean implements ScpSourceStreamResolver
Modifier and Type | Field and Description |
---|---|
protected java.nio.file.Path |
name |
protected ScpFileOpener |
opener |
protected java.nio.file.Path |
path |
protected java.util.Set<java.nio.file.attribute.PosixFilePermission> |
perms |
protected long |
size |
protected ScpTimestampCommandDetails |
time |
log
Constructor and Description |
---|
LocalFileScpSourceStreamResolver(java.nio.file.Path path,
ScpFileOpener opener) |
Modifier and Type | Method and Description |
---|---|
void |
closeSourceStream(Session session,
long length,
java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions,
java.io.InputStream stream)
Called when the stream obtained from
resolveSourceStream is no longer needed since since file copy was completed successfully. |
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() |
protected final java.nio.file.Path path
protected final ScpFileOpener opener
protected final java.nio.file.Path name
protected final java.util.Set<java.nio.file.attribute.PosixFilePermission> perms
protected final long size
protected final ScpTimestampCommandDetails time
public LocalFileScpSourceStreamResolver(java.nio.file.Path path, ScpFileOpener opener) throws java.io.IOException
java.io.IOException
public java.lang.String getFileName() throws java.io.IOException
getFileName
in interface ScpSourceStreamResolver
java.io.IOException
- If failed to resolve the namepublic java.util.Collection<java.nio.file.attribute.PosixFilePermission> getPermissions() throws java.io.IOException
getPermissions
in interface ScpSourceStreamResolver
java.io.IOException
- If failed to generate the required permissionspublic ScpTimestampCommandDetails getTimestamp() throws java.io.IOException
getTimestamp
in interface ScpSourceStreamResolver
ScpTimestampCommandDetails
to use for uploading the file if null
then no
need to send this informationjava.io.IOException
- If failed to generate the required datapublic long getSize() throws java.io.IOException
getSize
in interface ScpSourceStreamResolver
java.io.IOException
- If failed to generate an estimatepublic java.nio.file.Path getEventListenerFilePath()
getEventListenerFilePath
in interface ScpSourceStreamResolver
Path
to use when invoking the ScpTransferEventListener
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
resolveSourceStream
in interface ScpSourceStreamResolver
session
- The Session
through which file is transmittedlength
- The expected transfer byte countpermissions
- The requested file permissionsoptions
- The OpenOption
s may be null
/emptyInputStream
containing the data to be uploadedjava.io.IOException
- If failed to create the streampublic void closeSourceStream(Session session, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> permissions, java.io.InputStream stream) throws java.io.IOException
ScpSourceStreamResolver
resolveSourceStream
is no longer needed since since file copy was completed successfully.closeSourceStream
in interface ScpSourceStreamResolver
session
- The Session
through which file is transmittedlength
- The expected transfer byte countpermissions
- The requested file permissionsstream
- The InputStream
to closejava.io.IOException
- If failed to close the stream - Note: stream will be closed regardless of whether this
method throws an exception or not.public java.lang.String toString()
toString
in class java.lang.Object