Top Fields Constructors Methods
org.apache.sshd.scp.common.helpers

public Class LocalFileScpSourceStreamResolver

extends AbstractLoggingBean
implements ScpSourceStreamResolver
Class Inheritance
All Implemented Interfaces
org.apache.sshd.scp.common.ScpSourceStreamResolver
Imports
java.io.IOException, .InputStream, java.nio.file.Files, .OpenOption, .Path, java.nio.file.attribute.BasicFileAttributeView, .BasicFileAttributes, .PosixFilePermission, java.util.Collection, .Objects, .Set, org.apache.sshd.common.session.Session, org.apache.sshd.common.util.io.IoUtils, org.apache.sshd.common.util.logging.AbstractLoggingBean, org.apache.sshd.scp.common.ScpFileOpener, .ScpSourceStreamResolver

Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
protected final Path
protected final ScpFileOpener
protected final Path
protected final Set<PosixFilePermission>
protected final long
protected final ScpTimestampCommandDetails
Inherited from org.apache.sshd.common.util.logging.AbstractLoggingBean:
log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
closeSourceStream(Session
The Session through which file is transmitted
session
,
long
The expected transfer byte count
length
,
Set<PosixFilePermission>
The requested file permissions
permissions
,
InputStream
The InputStream to close
stream
)

Overrides default org.apache.sshd.scp.common.ScpSourceStreamResolver.closeSourceStream.

Called when the stream obtained from resolveSourceStream is no longer needed since since file copy was completed successfully.

public Path
public String
public Collection<PosixFilePermission>
public long
public ScpTimestampCommandDetails
public InputStream
resolveSourceStream(Session
The Session through which file is transmitted
session
,
long
The expected transfer byte count
length
,
Set<PosixFilePermission>
The requested file permissions
permissions
,
OpenOption...
The OpenOptions may be null/empty
options
)

Implements org.apache.sshd.scp.common.ScpSourceStreamResolver.resolveSourceStream.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from org.apache.sshd.common.util.logging.AbstractLoggingBean:
debugdebugdebugdebugdebugerrorerrorerrorerrorerrorgetSimplifiedLoggerinfoinfowarnwarnwarnwarnwarnwarnwarnwarn

Field Detail

nameback to summary
protected final Path name
openerback to summary
protected final ScpFileOpener opener
pathback to summary
protected final Path path
permsback to summary
protected final Set<PosixFilePermission> perms
sizeback to summary
protected final long size
timeback to summary
protected final ScpTimestampCommandDetails time

Constructor Detail

LocalFileScpSourceStreamResolverback to summary
public LocalFileScpSourceStreamResolver(Path path, ScpFileOpener opener) throws IOException

Method Detail

closeSourceStreamback to summary
public void closeSourceStream(Session session, long length, Set<PosixFilePermission> permissions, InputStream stream) throws IOException

Overrides default org.apache.sshd.scp.common.ScpSourceStreamResolver.closeSourceStream.

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.closeSourceStream.

Called when the stream obtained from resolveSourceStream is no longer needed since since file copy was completed successfully.

Parameters
session:Session

The Session through which file is transmitted

length:long

The expected transfer byte count

permissions:Set<PosixFilePermission>

The requested file permissions

stream:InputStream

The InputStream to close

Annotations
@Override
Exceptions
IOException:
If failed to close the stream - Note: stream will be closed regardless of whether this method throws an exception or not.
getEventListenerFilePathback to summary
public Path getEventListenerFilePath()

Implements org.apache.sshd.scp.common.ScpSourceStreamResolver.getEventListenerFilePath.

Returns:Path

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.getEventListenerFilePath.

The Path to use when invoking the ScpTransferEventListener

Annotations
@Override
getFileNameback to summary
public String getFileName() throws IOException

Implements org.apache.sshd.scp.common.ScpSourceStreamResolver.getFileName.

Returns:String

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.getFileName.

The uploaded file name

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.getFileName.

If failed to resolve the name

getPermissionsback to summary
public Collection<PosixFilePermission> getPermissions() throws IOException

Implements org.apache.sshd.scp.common.ScpSourceStreamResolver.getPermissions.

Returns:Collection<PosixFilePermission>

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.getPermissions.

The permissions to be used for uploading a file

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.getPermissions.

If failed to generate the required permissions

getSizeback to summary
public long getSize() throws IOException

Implements org.apache.sshd.scp.common.ScpSourceStreamResolver.getSize.

Returns:long

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.getSize.

An estimated size of the expected number of bytes to be uploaded. If non-positive then assumed to be unknown.

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.getSize.

If failed to generate an estimate

getTimestampback to summary
public ScpTimestampCommandDetails getTimestamp() throws IOException

Implements org.apache.sshd.scp.common.ScpSourceStreamResolver.getTimestamp.

Returns:ScpTimestampCommandDetails

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.getTimestamp.

The ScpTimestampCommandDetails to use for uploading the file if null then no need to send this information

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.getTimestamp.

If failed to generate the required data

resolveSourceStreamback to summary
public InputStream resolveSourceStream(Session session, long length, Set<PosixFilePermission> permissions, OpenOption... options) throws IOException

Implements org.apache.sshd.scp.common.ScpSourceStreamResolver.resolveSourceStream.

Parameters
session:Session

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.resolveSourceStream.

The Session through which file is transmitted

length:long

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.resolveSourceStream.

The expected transfer byte count

permissions:Set<PosixFilePermission>

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.resolveSourceStream.

The requested file permissions

options:OpenOption[]

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.resolveSourceStream.

The OpenOptions may be null/empty

Returns:InputStream

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.resolveSourceStream.

The InputStream containing the data to be uploaded

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.scp.common.ScpSourceStreamResolver.resolveSourceStream.

If failed to create the stream

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override