|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectverinec.util.SshCopy
public class SshCopy
Do remote file copying using secure shell (Scp). Currently depends on J2ssh, which is not very reliable. When the files to copy contain characters illegal on target system, J2ssh just ignores them without any warning.
J2sshProcess| Field Summary | |
|---|---|
private com.sshtools.j2ssh.ScpClient |
client
|
private com.sshtools.j2ssh.SshClient |
ssh
|
| Constructor Summary | |
|---|---|
SshCopy(String host,
int port,
String username,
String password,
String prefPublicKey,
File keyfile,
String passphrase,
String hostVerification)
Create a scp client with a remote system to copy files. |
|
| Method Summary | |
|---|---|
void |
disconnect()
Close the connection to the remote system. |
void |
get(String local,
String remote,
boolean recursive)
Copy a file from a remote system to our system. |
static void |
get(String local,
String remote,
boolean recursive,
String host,
int port,
String username,
String password,
String prefPublicKey,
File keyfile,
String passphrase,
String hostVerification)
Copy files from the remote system to our system. |
void |
put(String local,
String remote,
boolean recursive)
Copy a file from our system to the remote system. |
static void |
put(String local,
String remote,
boolean recursive,
String host,
int port,
String username,
String password,
String prefPublicKey,
File keyfile,
String passphrase,
String hostVerification)
Copy a file from our system to the remote system. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private com.sshtools.j2ssh.ScpClient client
private com.sshtools.j2ssh.SshClient ssh
| Constructor Detail |
|---|
public SshCopy(String host,
int port,
String username,
String password,
String prefPublicKey,
File keyfile,
String passphrase,
String hostVerification)
throws VerinecException
disconnect() when you do no longer need the connection.
host - Hostname to connect toport - A port number to use, pass -1 to leave defaultusername - The username to log into the remote system.password - The password to use for password authentication. If null, no password auth is attempted.prefPublicKey - The preferred public key algorithm. 'ssh-rsa' is a good choice.keyfile - The path to file containing the private keys. If null, no public key auth is attempted.passphrase - The passphrase to use with the key file. Pass null if no pass phrase needed.hostVerification - Requirement for host verification.
Possible values are ignore, interactive or the expected host fingerprint.
VerinecException - If the connection can not be opened for some reason.| Method Detail |
|---|
public void disconnect()
public void put(String local,
String remote,
boolean recursive)
throws IOException
local - The source file path on local machine.remote - The target file path on remote machine.recursive - Whether directories should be copyied recursively.
IOException - If the copy fails.
public void get(String local,
String remote,
boolean recursive)
throws IOException
local - The target local file path.remote - The source file path on remote machine.recursive - Whether directories should be copyied recursively.
IOException - If the copy fails.
public static void put(String local,
String remote,
boolean recursive,
String host,
int port,
String username,
String password,
String prefPublicKey,
File keyfile,
String passphrase,
String hostVerification)
throws VerinecException,
IOException
local - The source file path on local machine.remote - The target file path on remote machine.recursive - Whether directories should be copyied recursively.host - Hostname to connect toport - A port number to use, pass -1 to leave defaultusername - The username to log into the remote system.password - The password to use for password authentication. If null, no password auth is attempted.prefPublicKey - The preferred public key algorithm. 'ssh-rsa' is a good choice.keyfile - The path to file containing the private keys. If null, no public key auth is attempted.passphrase - The passphrase to use with the key file. Pass null if no pass phrase needed.hostVerification - Requirement for host verification.
Possible values are ignore, interactive or the expected host fingerprint.
VerinecException - If connecting to the remot system fails.
IOException - If the copy fails.
public static void get(String local,
String remote,
boolean recursive,
String host,
int port,
String username,
String password,
String prefPublicKey,
File keyfile,
String passphrase,
String hostVerification)
throws VerinecException,
IOException
local - The target local file path.remote - The source file path on remote machine.recursive - Whether directories should be copyied recursively.host - Hostname to connect toport - A port number to use, pass -1 to leave defaultusername - The username to log into the remote system.password - The password to use for password authentication. If null, no password auth is attempted.prefPublicKey - The preferred public key algorithm. 'ssh-rsa' is a good choice.keyfile - The path to file containing the private keys. If null, no public key auth is attempted.passphrase - The passphrase to use with the key file. Pass null if no pass phrase needed.hostVerification - Requirement for host verification.
Possible values are ignore, interactive or the expected host fingerprint.
VerinecException - If connecting to the remot system fails.
IOException - If the copy fails.
|
Copyright © 2005 Verinec, DIUF | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||