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 Charset
protected final Charset
private final ClientSession
protected final ScpRemote2RemoteTransferListener
private final ClientSession
Fields 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 void
executeTransfer
(String source, Collection<ScpClient.Option> srcOptions, String destination, Collection<ScpClient.Option> dstOptions) protected void
handleDirectoryTransferRequest
(String srcPath, InputStream srcIn, OutputStream srcOut, String dstPath, InputStream dstIn, OutputStream dstOut, int depth, ScpTimestampCommandDetails dirTime, String header) protected long
handleFileTransferRequest
(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, ScpTimestampCommandDetails fileTime, String header) protected Object
receiveNextCmd
(Object logHint, InputStream in) protected void
redirectDirectoryTransfer
(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, int depth) protected long
redirectFileTransfer
(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut) protected void
toString()
void
transferDirectory
(String source, String destination, boolean preserveAttributes) Transfers a directoryvoid
transferFile
(String source, String destination, boolean preserveAttributes) Transfers a single fileprotected long
transferSimpleFile
(String source, InputStream srcIn, OutputStream srcOut, String destination, InputStream dstIn, OutputStream dstOut, String header, long length) protected ScpAckInfo
transferStatusCode
(Object logHint, InputStream in, OutputStream out) protected String
transferTimestampCommand
(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 sourceClientSession
destSession
- The destinationClientSession
listener
- 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
-