public class ScpClientIO.ScpEngineIO
extends java.lang.Object
Implements an SCP engine.
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
buffer |
protected java.lang.String |
cmd |
protected java.io.InputStream |
in |
protected java.io.OutputStream |
out |
protected SessionChannel |
session |
| Modifier | Constructor and Description |
|---|---|
protected |
ScpEngineIO(java.lang.String cmd,
SessionChannelNG session)
Contruct the channel with the specified scp command.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the SCP engine and underlying session.
|
protected void |
parseCommand(java.lang.String cmd,
java.lang.String[] cmdParts)
Parse an SCP command
|
protected void |
readCompleteFile(java.io.OutputStream out,
long size,
FileTransferProgress progress) |
protected java.io.InputStream |
readStreamFromRemote(java.lang.String remoteFile,
FileTransferProgress progress)
Open an InputStream.
|
protected java.lang.String |
readString()
read the inputstream until come to an end of line character '\n', and
return the bytes read as a string
|
void |
waitForResponse() |
protected void |
writeCompleteFile(java.io.InputStream in,
long size,
FileTransferProgress progress) |
protected void |
writeError(java.lang.String reason) |
protected void |
writeOk() |
protected void |
writeStreamToRemote(java.io.InputStream in,
long length,
java.lang.String localName,
FileTransferProgress progress)
Write a stream as a file to the remote server.
|
protected byte[] buffer
protected java.lang.String cmd
protected SessionChannel session
protected java.io.OutputStream out
protected java.io.InputStream in
protected ScpEngineIO(java.lang.String cmd,
SessionChannelNG session)
throws SshException
Contruct the channel with the specified scp command.
cmd - the scp commandsession - the session to scp overSshExceptionpublic void close()
throws SshException
SshExceptionprotected void writeStreamToRemote(java.io.InputStream in,
long length,
java.lang.String localName,
FileTransferProgress progress)
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 namejava.io.IOException - if an IO error occursprotected java.io.InputStream readStreamFromRemote(java.lang.String remoteFile,
FileTransferProgress progress)
throws java.io.IOException
remoteFile - progress - java.io.IOExceptionprotected void parseCommand(java.lang.String cmd,
java.lang.String[] cmdParts)
throws java.io.IOException
cmd - cmdParts - java.io.IOExceptionprotected java.lang.String readString()
throws java.io.IOException
java.io.IOExceptionpublic void waitForResponse()
throws java.io.IOException
java.io.IOExceptionprotected void writeOk()
throws java.io.IOException
java.io.IOExceptionprotected void writeError(java.lang.String reason)
throws java.io.IOException
java.io.IOExceptionprotected void writeCompleteFile(java.io.InputStream in,
long size,
FileTransferProgress progress)
throws java.io.IOException
java.io.IOExceptionprotected void readCompleteFile(java.io.OutputStream out,
long size,
FileTransferProgress progress)
throws java.io.IOException
java.io.IOExceptionCopyright © 2022. All rights reserved.