Package org.apache.sshd.scp.common
Interface ScpTargetStreamResolver
- All Known Implementing Classes:
LocalFileScpTargetStreamResolver
public interface ScpTargetStreamResolver
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidcloseTargetStream(Session session, String name, long length, Set<PosixFilePermission> perms, OutputStream stream) Called when target stream received fromresolveTargetStreamcall is no longer needed since copy is successfully completed.voidpostProcessReceivedData(String name, boolean preserve, Set<PosixFilePermission> perms, ScpTimestampCommandDetails time) Called after successful reception of the data (and after closing the stream)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 data
-
Method Details
-
resolveTargetStream
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- The associatedSessionname- File name as received from remote sitelength- Number of bytes expected to receiveperms- TheSetofPosixFilePermissionexpectedoptions- TheOpenOptions to use - may benull/empty- Returns:
- The
OutputStreamto write the incoming data - Throws:
IOException- If failed to create the stream
-
closeTargetStream
default void closeTargetStream(Session session, String name, long length, Set<PosixFilePermission> perms, OutputStream stream) throws IOException Called when target stream received fromresolveTargetStreamcall is no longer needed since copy is successfully completed.- Parameters:
session- The associatedSessionname- File name as received from remote sitelength- Number of bytes expected to receiveperms- TheSetofPosixFilePermissionexpectedstream- TheOutputStreamto 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
Path getEventListenerFilePath()- Returns:
- The
Pathto use when invoking theScpTransferEventListener
-
postProcessReceivedData
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- File name as received from remote sitepreserve- Iftruethen the resolver should attempt to preserve the specified permissions and timestampperms- TheSetofPosixFilePermissionexpectedtime- If notnullthen the required timestamp(s) on the incoming data- Throws:
IOException- If failed to post-process the incoming data
-