public final class ScpClient
extends java.lang.Object
Implements a Secure Copy (SCP) client. This may be useful when the server does not support SFTP.
| Constructor and Description |
|---|
ScpClient(java.io.File cwd,
SshClient ssh,
boolean verbose,
ChannelEventListener eventListener)
Creates an SCP client.
|
ScpClient(SshClient ssh,
boolean verbose,
ChannelEventListener eventListener)
Creates an SCP client.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.InputStream |
get(java.lang.String remoteFile)
Gets a remote file as an
java.io.InputStream. |
void |
get(java.lang.String localFile,
java.lang.String[] remoteFiles,
boolean recursive)
Downloads an array of remote files to the local computer.
|
void |
get(java.lang.String localFile,
java.lang.String remoteFile,
boolean recursive)
Downloads a remote file onto the local computer.
|
void |
put(java.io.InputStream in,
long length,
java.lang.String localFile,
java.lang.String remoteFile)
Uploads a
java.io.InputStream to a remove server as file. |
void |
put(java.lang.String[] localFiles,
java.lang.String remoteFile,
boolean recursive)
Uploads an array of local files onto the remote server.
|
void |
put(java.lang.String localFile,
java.lang.String remoteFile,
boolean recursive)
Uploads a local file onto the remote server.
|
public ScpClient(SshClient ssh, boolean verbose, ChannelEventListener eventListener)
Creates an SCP client. CWD (Current working directory) will be the CWD of the process that started this JVM.
ssh - A connected SshClientverbose - Output verbose detaileventListener - public ScpClient(java.io.File cwd,
SshClient ssh,
boolean verbose,
ChannelEventListener eventListener)
Creates an SCP client.
cwd - The current local directoryssh - A connected SshClientverbose - Output verbose detaileventListener - public void put(java.io.InputStream in,
long length,
java.lang.String localFile,
java.lang.String remoteFile)
throws java.io.IOException
Uploads a java.io.InputStream to a remove server as file.
You must supply the correct number of bytes that will
be written.
in - stream providing filelength - number of bytes that will be writtenlocalFile - local file nameremoteFile - remote file namejava.io.IOException - on any errorpublic java.io.InputStream get(java.lang.String remoteFile)
throws java.io.IOException
Gets a remote file as an java.io.InputStream.
remoteFile - remote file namejava.io.IOException - on any errorpublic void put(java.lang.String localFile,
java.lang.String remoteFile,
boolean recursive)
throws java.io.IOException
Uploads a local file onto the remote server.
localFile - The path to the local file relative to the local
current directory; may be a file or directoryremoteFile - The path on the remote server, may be a file or
directoryrecursive - Copy the contents of a directory recursivlyjava.io.IOException - if an IO error occurs during the operationpublic void put(java.lang.String[] localFiles,
java.lang.String remoteFile,
boolean recursive)
throws java.io.IOException
Uploads an array of local files onto the remote server.
localFiles - an array of local files; may be files or directoriesremoteFile - the path on the remote server, may be a file or
directory1recursive - Copy the contents of directorys recursivlyjava.io.IOException - if an IO error occurs during the operationpublic void get(java.lang.String localFile,
java.lang.String[] remoteFiles,
boolean recursive)
throws java.io.IOException
Downloads an array of remote files to the local computer.
localFile - The local path to place the filesremoteFiles - The path of the remote filesrecursive - recursivly copy the contents of a directoryjava.io.IOException - if an IO error occurs during the operationpublic void get(java.lang.String localFile,
java.lang.String remoteFile,
boolean recursive)
throws java.io.IOException
Downloads a remote file onto the local computer.
localFile - The path to place the fileremoteFile - The path of the file on the remote serverrecursive - recursivly copy the contents of a directoryjava.io.IOException - if an IO error occurs during the operationCopyright © 2002-2003 Lee David Painter & Contributors. All Rights Reserved.