Class LocalFileScpTargetStreamResolver
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.scp.helpers.LocalFileScpTargetStreamResolver
-
- All Implemented Interfaces:
ScpTargetStreamResolver
public class LocalFileScpTargetStreamResolver extends AbstractLoggingBean implements ScpTargetStreamResolver
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description protected ScpFileOpener
opener
protected Path
path
protected Boolean
status
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description LocalFileScpTargetStreamResolver(Path path, ScpFileOpener opener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeTargetStream(Session session, String name, long length, Set<PosixFilePermission> perms, OutputStream stream)
Called when target stream received fromresolveTargetStream
call is no longer needed since copy is successfully completed.Path
getEventListenerFilePath()
void
postProcessReceivedData(String name, boolean preserve, Set<PosixFilePermission> perms, ScpTimestamp time)
Called after successful reception of the data (and after closing the stream)OutputStream
resolveTargetStream(Session session, String name, long length, Set<PosixFilePermission> perms, OpenOption... options)
Called when receiving a file in order to obtain an output stream for the incoming dataString
toString()
protected void
updateFileProperties(String name, Path path, Set<PosixFilePermission> perms, ScpTimestamp time)
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
getSimplifiedLogger
-
-
-
-
Field Detail
-
path
protected final Path path
-
opener
protected final ScpFileOpener opener
-
status
protected final Boolean status
-
-
Constructor Detail
-
LocalFileScpTargetStreamResolver
public LocalFileScpTargetStreamResolver(Path path, ScpFileOpener opener) throws IOException
- Throws:
IOException
-
-
Method Detail
-
resolveTargetStream
public OutputStream resolveTargetStream(Session session, String name, long length, Set<PosixFilePermission> perms, OpenOption... options) throws IOException
Description copied from interface:ScpTargetStreamResolver
Called when receiving a file in order to obtain an output stream for the incoming data- Specified by:
resolveTargetStream
in interfaceScpTargetStreamResolver
- Parameters:
session
- The associatedSession
name
- File name as received from remote sitelength
- Number of bytes expected to receiveperms
- TheSet
ofPosixFilePermission
expectedoptions
- TheOpenOption
s to use - may benull
/empty- Returns:
- The
OutputStream
to write the incoming data - Throws:
IOException
- If failed to create the stream
-
closeTargetStream
public void closeTargetStream(Session session, String name, long length, Set<PosixFilePermission> perms, OutputStream stream) throws IOException
Description copied from interface:ScpTargetStreamResolver
Called when target stream received fromresolveTargetStream
call is no longer needed since copy is successfully completed.- Specified by:
closeTargetStream
in interfaceScpTargetStreamResolver
- Parameters:
session
- The associatedSession
name
- File name as received from remote sitelength
- Number of bytes expected to receiveperms
- TheSet
ofPosixFilePermission
expectedstream
- TheOutputStream
to close- Throws:
IOException
- If failed to close the stream - Note: stream will be closed regardless of whether this method throws an exception or not.
-
getEventListenerFilePath
public Path getEventListenerFilePath()
- Specified by:
getEventListenerFilePath
in interfaceScpTargetStreamResolver
- Returns:
- The
Path
to use when invoking theScpTransferEventListener
-
postProcessReceivedData
public void postProcessReceivedData(String name, boolean preserve, Set<PosixFilePermission> perms, ScpTimestamp time) throws IOException
Description copied from interface:ScpTargetStreamResolver
Called after successful reception of the data (and after closing the stream)- Specified by:
postProcessReceivedData
in interfaceScpTargetStreamResolver
- Parameters:
name
- File name as received from remote sitepreserve
- Iftrue
then the resolver should attempt to preserve the specified permissions and timestampperms
- TheSet
ofPosixFilePermission
expectedtime
- If notnull
then the required timestamp(s) on the incoming data- Throws:
IOException
- If failed to post-process the incoming data
-
updateFileProperties
protected void updateFileProperties(String name, Path path, Set<PosixFilePermission> perms, ScpTimestamp time) throws IOException
- Throws:
IOException
-
-