Top Methods
org.apache.sshd.scp.common

public Interface ScpTargetStreamResolver

Known Direct Implementers
org.apache.sshd.scp.common.helpers.LocalFileScpTargetStreamResolver
Imports
java.io.IOException, .OutputStream, java.nio.file.OpenOption, .Path, java.nio.file.attribute.PosixFilePermission, java.util.Set, org.apache.sshd.common.session.Session, org.apache.sshd.scp.common.helpers.ScpTimestampCommandDetails

Author
Apache MINA SSHD Project

Method Summary

Modifier and TypeMethod and Description
public default 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
)

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

public Path

Returns:

The Path to use when invoking the ScpTransferEventListener
getEventListenerFilePath
()

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
)

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

public OutputStream

Returns:

The OutputStream to write the incoming data
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
)

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

Method Detail

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

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

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()
Returns:Path

The Path to use when invoking the ScpTransferEventListener

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

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

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

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

Exceptions
IOException:
If failed to create the stream