public class SCPClient extends Object
SCPClient that can be used to copy files from/to
the SSH-2 server. On the server side, the "scp" program must be in the PATH.
This scp client is thread safe - you can download (and upload) different sets
of files concurrently without any troubles. The SCPClient is
actually mapping every request to a distinct Session.| Modifier and Type | Class and Description |
|---|---|
class |
SCPClient.LenNamePair |
| Constructor and Description |
|---|
SCPClient(Connection conn) |
| Modifier and Type | Method and Description |
|---|---|
SCPInputStream |
get(String remoteFile)
The session for opened for this SCP transfer must be closed using
SCPInputStream#close
|
String |
getCharset()
The currently used charset for filename encoding/decoding.
|
protected SCPClient.LenNamePair |
parseCLine(String line) |
SCPOutputStream |
put(String remoteFile,
long length,
String remoteTargetDirectory,
String mode)
The session for opened for this SCP transfer must be closed using
SCPOutputStream#close
|
protected void |
readResponse(InputStream is) |
protected String |
receiveLine(InputStream is) |
void |
setCharset(String charset)
Set the charset used to convert between Java Unicode Strings and byte encodings
used by the server for paths and file names.
|
public SCPClient(Connection conn)
public void setCharset(String charset) throws IOException
charset - the name of the charset to be used or null to use the platform's
default encoding.IOExceptiongetCharset()public String getCharset()
null if the platform's default charset is being used)setCharset(String)protected void readResponse(InputStream is) throws IOException
IOExceptionprotected String receiveLine(InputStream is) throws IOException
IOExceptionprotected SCPClient.LenNamePair parseCLine(String line) throws IOException
IOExceptionpublic SCPOutputStream put(String remoteFile, long length, String remoteTargetDirectory, String mode) throws IOException
remoteFile - length - The size of the file to sendremoteTargetDirectory - mode - IOExceptionpublic SCPInputStream get(String remoteFile) throws IOException
remoteFile - IOExceptionCopyright © 2014. All Rights Reserved.