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

public Class LocalFileScpTargetStreamResolver

extends AbstractLoggingBean
implements ScpTargetStreamResolver
Class Inheritance
All Implemented Interfaces
org.apache.sshd.scp.common.ScpTargetStreamResolver
Imports
java.io.File, .IOException, .OutputStream, .StreamCorruptedException, java.nio.file.AccessDeniedException, .Files, .LinkOption, .OpenOption, .Path, java.nio.file.attribute.BasicFileAttributeView, .FileTime, .PosixFilePermission, java.util.Set, java.util.concurrent.TimeUnit, 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, .ScpTargetStreamResolver

Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private Path
protected final ScpFileOpener
protected final Path
protected final Boolean
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
closeTargetStream(Session
The associated Session
session
,
String
File name as received from remote site
name
,
long
Number of bytes expected to receive
length
,
Set<PosixFilePermission>
The Set of PosixFilePermission expected
perms
,
OutputStream
The OutputStream to close
stream
)

Overrides default org.apache.sshd.scp.common.ScpTargetStreamResolver.closeTargetStream.

Called when target stream received from resolveTargetStream call is no longer needed since copy is successfully completed.

public Path
public void
postProcessReceivedData(String
File name as received from remote site
name
,
boolean
If true then the resolver should attempt to preserve the specified permissions and timestamp
preserve
,
Set<PosixFilePermission>
The Set of PosixFilePermission expected
perms
,
ScpTimestampCommandDetails
If not null then the required timestamp(s) on the incoming data
time
)

Implements org.apache.sshd.scp.common.ScpTargetStreamResolver.postProcessReceivedData.

Called after successful reception of the data (and after closing the stream)

public OutputStream
resolveTargetStream(Session
The associated Session
session
,
String
File name as received from remote site
name
,
long
Number of bytes expected to receive
length
,
Set<PosixFilePermission>
The Set of PosixFilePermission expected
perms
,
OpenOption...
The OpenOptions to use - may be null/empty
options
)

Implements org.apache.sshd.scp.common.ScpTargetStreamResolver.resolveTargetStream.

Called when receiving a file in order to obtain an output stream for the incoming data

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

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

Field Detail

fileback to summary
private Path file
openerback to summary
protected final ScpFileOpener opener
pathback to summary
protected final Path path
statusback to summary
protected final Boolean status

Constructor Detail

LocalFileScpTargetStreamResolverback to summary
public LocalFileScpTargetStreamResolver(Path path, ScpFileOpener opener) throws IOException

Method Detail

closeTargetStreamback to summary
public void closeTargetStream(Session session, String name, long length, Set<PosixFilePermission> perms, OutputStream stream) throws IOException

Overrides default org.apache.sshd.scp.common.ScpTargetStreamResolver.closeTargetStream.

Doc from org.apache.sshd.scp.common.ScpTargetStreamResolver.closeTargetStream.

Called when target stream received from resolveTargetStream call is no longer needed since copy is successfully completed.

Parameters
session:Session

The associated Session

name:String

File name as received from remote site

length:long

Number of bytes expected to receive

perms:Set<PosixFilePermission>

The Set of PosixFilePermission expected

stream:OutputStream

The OutputStream 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.ScpTargetStreamResolver.getEventListenerFilePath.

Returns:Path

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

The Path to use when invoking the ScpTransferEventListener

Annotations
@Override
postProcessReceivedDataback to summary
public void postProcessReceivedData(String name, boolean preserve, Set<PosixFilePermission> perms, ScpTimestampCommandDetails time) throws IOException

Implements org.apache.sshd.scp.common.ScpTargetStreamResolver.postProcessReceivedData.

Doc from org.apache.sshd.scp.common.ScpTargetStreamResolver.postProcessReceivedData.

Called after successful reception of the data (and after closing the stream)

Parameters
name:String

File name as received from remote site

preserve:boolean

If true then the resolver should attempt to preserve the specified permissions and timestamp

perms:Set<PosixFilePermission>

The Set of PosixFilePermission expected

time:ScpTimestampCommandDetails

If not null then the required timestamp(s) on the incoming data

Annotations
@Override
Exceptions
IOException:
If failed to post-process the incoming data
resolveTargetStreamback to summary
public OutputStream resolveTargetStream(Session session, String name, long length, Set<PosixFilePermission> perms, OpenOption... options) throws IOException

Implements org.apache.sshd.scp.common.ScpTargetStreamResolver.resolveTargetStream.

Doc from org.apache.sshd.scp.common.ScpTargetStreamResolver.resolveTargetStream.

Called when receiving a file in order to obtain an output stream for the incoming data

Parameters
session:Session

The associated Session

name:String

File name as received from remote site

length:long

Number of bytes expected to receive

perms:Set<PosixFilePermission>

The Set of PosixFilePermission expected

options:OpenOption[]

The OpenOptions to use - may be null/empty

Returns:OutputStream

The OutputStream to write the incoming data

Annotations
@Override
Exceptions
IOException:
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
updateFilePropertiesback to summary
protected void updateFileProperties(String name, Path path, Set<PosixFilePermission> perms, ScpTimestampCommandDetails time) throws IOException