Package org.apache.sshd.scp.client
Class ScpRemote2RemoteTransferHelper
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.scp.client.ScpRemote2RemoteTransferHelper
-
public class ScpRemote2RemoteTransferHelper extends org.apache.sshd.common.util.logging.AbstractLoggingBeanHelps transfer files between 2 servers rather than between server and local file system by using 2ClientSession-s and simply copying from one server to the other- Author:
- Apache MINA SSHD Project
-
-
Constructor Summary
Constructors Constructor Description ScpRemote2RemoteTransferHelper(ClientSession sourceSession, ClientSession destSession)ScpRemote2RemoteTransferHelper(ClientSession sourceSession, ClientSession destSession, ScpRemote2RemoteTransferListener listener)
-
Method Summary
-
-
-
Field Detail
-
listener
protected final ScpRemote2RemoteTransferListener listener
-
csIn
protected final Charset csIn
-
csOut
protected final Charset csOut
-
-
Constructor Detail
-
ScpRemote2RemoteTransferHelper
public ScpRemote2RemoteTransferHelper(ClientSession sourceSession, ClientSession destSession)
-
ScpRemote2RemoteTransferHelper
public ScpRemote2RemoteTransferHelper(ClientSession sourceSession, ClientSession destSession, ScpRemote2RemoteTransferListener listener)
- Parameters:
sourceSession- The sourceClientSessiondestSession- The destinationClientSessionlistener- An optionalScpRemote2RemoteTransferListener
-
-
Method Detail
-
getSourceSession
public ClientSession getSourceSession()
-
getDestinationSession
public ClientSession 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
protected Object receiveNextCmd(Object logHint, InputStream in) throws IOException
- Throws:
IOException
-
signalReceivedCommand
protected void signalReceivedCommand(AbstractScpCommandDetails details) throws IOException
- Throws:
IOException
-
-