|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sshtools.j2ssh.connection.Channel
com.sshtools.j2ssh.connection.IOChannel
com.sshtools.j2ssh.session.SessionChannelClient
com.sshtools.j2ssh.ScpClient.ScpChannel
class ScpClient.ScpChannel
Implements an SCP channel by extending the
SessionChannelClient
.
Field Summary | |
---|---|
(package private) byte[] |
buffer
|
(package private) java.lang.String |
cmd
|
Fields inherited from class com.sshtools.j2ssh.connection.IOChannel |
---|
boundInputStream, boundOutputStream, in, ios, out |
Fields inherited from class com.sshtools.j2ssh.connection.Channel |
---|
connection, localChannelId, localPacketSize, localWindow, remoteChannelId, remotePacketSize, remoteWindow, state |
Constructor Summary | |
---|---|
ScpClient.ScpChannel(java.lang.String cmd)
Contruct the channel with the specified scp command. |
Method Summary | |
---|---|
protected void |
onChannelOpen()
This implementation executes the scp command when the channel is opened. |
private void |
parseCommand(java.lang.String cmd,
java.lang.String[] cmdParts)
|
private void |
readCompleteFile(java.io.FileOutputStream file,
long size)
|
private void |
readFromRemote(java.io.File file)
|
private java.io.InputStream |
readStreamFromRemote()
|
private java.lang.String |
readString()
|
private void |
waitForResponse()
|
private void |
writeCompleteFile(java.io.InputStream file,
long size)
|
private boolean |
writeDirToRemote(java.io.File dir,
boolean recursive)
Writes a directory to the remote server. |
private void |
writeError(java.lang.String reason)
|
private void |
writeFileToRemote(java.io.File file,
boolean recursive)
Write a file to the remote server. |
private void |
writeOk()
|
private void |
writeStreamToRemote(java.io.InputStream in,
long length,
java.lang.String localName)
Write a stream as a file to the remote server. |
Methods inherited from class com.sshtools.j2ssh.connection.IOChannel |
---|
bindInputStream, bindOutputStream, getInputStream, getOutputStream, init, onChannelData, onChannelEOF, open, setLocalEOF |
Methods inherited from class com.sshtools.j2ssh.connection.Channel |
---|
addEventListener, close, finalizeClose, getLocalChannelId, getLocalPacketSize, getLocalWindow, getName, getRemoteChannelId, getRemotePacketSize, getRemoteWindow, getState, init, isClosed, isLocalEOF, isOpen, isRemoteEOF, processChannelData, processChannelData, remoteClose, sendChannelData, sendChannelExtData, setName, setRemoteEOF |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
byte[] buffer
java.lang.String cmd
Constructor Detail |
---|
ScpClient.ScpChannel(java.lang.String cmd)
Contruct the channel with the specified scp command.
cmd
- The scp commandMethod Detail |
---|
protected void onChannelOpen() throws java.io.IOException
This implementation executes the scp command when the channel is opened.
onChannelOpen
in class SessionChannelClient
java.io.IOException
private boolean writeDirToRemote(java.io.File dir, boolean recursive) throws java.io.IOException
Writes a directory to the remote server.
dir
- The source directoryrecursive
- Add the contents of the directory recursivley
java.io.IOException
- if an IO error occursprivate void writeStreamToRemote(java.io.InputStream in, long length, java.lang.String localName) throws java.io.IOException
Write a stream as a file to the remote server. You must supply the correct number of bytes that will be written.
in
- streamlength
- number of bytes to writelocalName
- local file name
java.io.IOException
- if an IO error occursprivate void writeFileToRemote(java.io.File file, boolean recursive) throws java.io.IOException
Write a file to the remote server.
file
- The source filerecursive
- Add the contents of the directory recursivley
java.io.IOException
- if an IO error occursprivate void readFromRemote(java.io.File file) throws java.io.IOException
java.io.IOException
private java.io.InputStream readStreamFromRemote() throws java.io.IOException
java.io.IOException
private void parseCommand(java.lang.String cmd, java.lang.String[] cmdParts) throws java.io.IOException
java.io.IOException
private java.lang.String readString() throws java.io.IOException
java.io.IOException
private void waitForResponse() throws java.io.IOException
java.io.IOException
private void writeOk() throws java.io.IOException
java.io.IOException
private void writeError(java.lang.String reason) throws java.io.IOException
java.io.IOException
private void writeCompleteFile(java.io.InputStream file, long size) throws java.io.IOException
java.io.IOException
private void readCompleteFile(java.io.FileOutputStream file, long size) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |