Package adams.core.net
Class Scp
- java.lang.Object
-
- adams.core.net.Scp
-
public class Scp extends Object
Class for SCP actions.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description Scp()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
checkAck(InputStream in)
Checks the stream (scp).static String
copyFrom(LoggingObject owner, SSHSessionProvider provider, String host, int port, String remoteFile, File localFile)
Copies a remote file onto the local machine.static String
copyFrom(LoggingObject owner, SSHSessionProvider provider, String remoteFile, File localFile)
Copies a remote file onto the local machine.static String
copyTo(LoggingObject owner, SSHSessionProvider provider, File localFile, String remoteFile)
Copies a local file to a remote server.static String
copyTo(LoggingObject owner, SSHSessionProvider provider, String host, int port, File localFile, String remoteFile)
Copies a local file to a remote server.
-
-
-
Method Detail
-
copyTo
public static String copyTo(LoggingObject owner, SSHSessionProvider provider, File localFile, String remoteFile)
Copies a local file to a remote server.- Parameters:
owner
- the owner that initiates the transfer, can be nullprovider
- the SSH session provider to uselocalFile
- the local fileremoteFile
- the remote file- Returns:
- null if successful, otherwise error message
-
copyTo
public static String copyTo(LoggingObject owner, SSHSessionProvider provider, String host, int port, File localFile, String remoteFile)
Copies a local file to a remote server.- Parameters:
owner
- the owner that initiates the transfer, can be nullprovider
- the SSH session provider to usehost
- an alternative host, null if to use one from connectionport
- an alternative port, ignored if host nulllocalFile
- the local fileremoteFile
- the remote file- Returns:
- null if successful, otherwise error message
-
copyFrom
public static String copyFrom(LoggingObject owner, SSHSessionProvider provider, String remoteFile, File localFile)
Copies a remote file onto the local machine.- Parameters:
owner
- the owner that initiates the transferprovider
- the SSH session provider to useremoteFile
- the remote file to copylocalFile
- the local file- Returns:
- null if successful, otherwise error message
-
copyFrom
public static String copyFrom(LoggingObject owner, SSHSessionProvider provider, String host, int port, String remoteFile, File localFile)
Copies a remote file onto the local machine.- Parameters:
owner
- the owner that initiates the transferprovider
- the SSH session provider to usehost
- an alternative host, null if to use one from connectionport
- an alternative port, ignored if host nullremoteFile
- the remote file to copylocalFile
- the local file- Returns:
- null if successful, otherwise error message
-
checkAck
public static int checkAck(InputStream in) throws IOException
Checks the stream (scp).- Parameters:
in
- the stream to use- Returns:
- 0 = success, 1 = error, 2 = fatal error, -1 = end of stream
- Throws:
IOException
-
-