Package org.apache.sshd.scp.client
Class ScpRemote2RemoteTransferHelper
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.scp.client.ScpRemote2RemoteTransferHelper
Helps transfer files between 2 servers rather than between server and local file system by using 2
ClientSession-s and simply copying from one server to the other-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Charsetprotected final Charsetprivate final ClientSessionprotected final ScpRemote2RemoteTransferListenerprivate final ClientSessionFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionScpRemote2RemoteTransferHelper(ClientSession sourceSession, ClientSession destSession) ScpRemote2RemoteTransferHelper(ClientSession sourceSession, ClientSession destSession, ScpRemote2RemoteTransferListener listener) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexecuteTransfer(String source, Collection<ScpClient.Option> srcOptions, String destination, Collection<ScpClient.Option> dstOptions) protected voidhandleDirectoryTransferRequest(String srcPath, InputStream srcIn, OutputStream srcOut, String dstPath, InputStream dstIn, OutputStream dstOut, int depth, ScpTimestampCommandDetails dirTime, String header) protected longhandleFileTransferRequest(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, ScpTimestampCommandDetails fileTime, String header) protected ObjectreceiveNextCmd(Object logHint, InputStream in) protected voidredirectDirectoryTransfer(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, int depth) protected longredirectFileTransfer(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut) protected voidtoString()voidtransferDirectory(String source, String destination, boolean preserveAttributes) Transfers a directoryvoidtransferFile(String source, String destination, boolean preserveAttributes) Transfers a single fileprotected longtransferSimpleFile(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, String header, long length) protected ScpAckInfotransferStatusCode(Object logHint, InputStream in, OutputStream out) protected StringtransferTimestampCommand(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, String header)
-
Field Details
-
listener
-
csIn
-
csOut
-
sourceSession
-
destSession
-
-
Constructor Details
-
ScpRemote2RemoteTransferHelper
-
ScpRemote2RemoteTransferHelper
public ScpRemote2RemoteTransferHelper(ClientSession sourceSession, ClientSession destSession, ScpRemote2RemoteTransferListener listener) - Parameters:
sourceSession- The sourceClientSessiondestSession- The destinationClientSessionlistener- An optionalScpRemote2RemoteTransferListener
-
-
Method Details
-
getSourceSession
-
getDestinationSession
-
transferFile
public void transferFile(String source, String destination, boolean preserveAttributes) throws IOException Transfers a single file- Parameters:
source- Source path in the source sessiondestination- Destination path in the destination sessionpreserveAttributes- Whether to preserve the attributes of the transferred file (e.g., permissions, file associated timestamps, etc.)- Throws:
IOException- If failed to transfer
-
transferDirectory
public void transferDirectory(String source, String destination, boolean preserveAttributes) throws IOException Transfers a directory- Parameters:
source- Source path in the source sessiondestination- Destination path in the destination sessionpreserveAttributes- Whether to preserve the attributes of the transferred file (e.g., permissions, file associated timestamps, etc.)- Throws:
IOException- If failed to transfer
-
executeTransfer
protected void executeTransfer(String source, Collection<ScpClient.Option> srcOptions, String destination, Collection<ScpClient.Option> dstOptions) throws IOException - Throws:
IOException
-
redirectFileTransfer
protected long redirectFileTransfer(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut) throws IOException - Throws:
IOException
-
handleFileTransferRequest
protected long handleFileTransferRequest(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, ScpTimestampCommandDetails fileTime, String header) throws IOException - Throws:
IOException
-
redirectDirectoryTransfer
protected void redirectDirectoryTransfer(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, int depth) throws IOException - Throws:
IOException
-
handleDirectoryTransferRequest
protected void handleDirectoryTransferRequest(String srcPath, InputStream srcIn, OutputStream srcOut, String dstPath, InputStream dstIn, OutputStream dstOut, int depth, ScpTimestampCommandDetails dirTime, String header) throws IOException - Throws:
IOException
-
transferSimpleFile
protected long transferSimpleFile(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, String header, long length) throws IOException - Throws:
IOException
-
transferTimestampCommand
protected String transferTimestampCommand(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, String header) throws IOException - Throws:
IOException
-
transferStatusCode
protected ScpAckInfo transferStatusCode(Object logHint, InputStream in, OutputStream out) throws IOException - Throws:
IOException
-
receiveNextCmd
- Throws:
IOException
-
signalReceivedCommand
- Throws:
IOException
-
toString
-