public class ScpClientIO.ScpEngineIO extends Object
Implements an SCP engine.
Modifier and Type | Field and Description |
---|---|
protected byte[] |
buffer |
protected String |
cmd |
protected InputStream |
in |
protected OutputStream |
out |
protected SshSession |
session |
Modifier | Constructor and Description |
---|---|
protected |
ScpEngineIO(String cmd,
SshSession 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(String cmd,
String[] cmdParts)
Parse an SCP command
|
protected void |
readCompleteFile(OutputStream out,
long size,
FileTransferProgress progress) |
protected InputStream |
readStreamFromRemote(String remoteFile,
FileTransferProgress progress)
Open an InputStream.
|
protected 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(InputStream in,
long size,
FileTransferProgress progress) |
protected void |
writeError(String reason) |
protected void |
writeOk() |
protected void |
writeStreamToRemote(InputStream in,
long length,
String localName,
FileTransferProgress progress)
Write a stream as a file to the remote server.
|
protected byte[] buffer
protected String cmd
protected SshSession session
protected OutputStream out
protected InputStream in
protected ScpEngineIO(String cmd, SshSession session) throws SshException
Contruct the channel with the specified scp command.
cmd
- the scp commandsession
- the session to scp overSshException
public void close() throws SshException
SshException
protected void writeStreamToRemote(InputStream in, long length, String localName, FileTransferProgress progress) throws 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 nameIOException
- if an IO error occursprotected InputStream readStreamFromRemote(String remoteFile, FileTransferProgress progress) throws IOException
remoteFile
- progress
- IOException
protected void parseCommand(String cmd, String[] cmdParts) throws IOException
cmd
- cmdParts
- IOException
protected String readString() throws IOException
IOException
public void waitForResponse() throws IOException
IOException
protected void writeOk() throws IOException
IOException
protected void writeError(String reason) throws IOException
IOException
protected void writeCompleteFile(InputStream in, long size, FileTransferProgress progress) throws IOException
IOException
protected void readCompleteFile(OutputStream out, long size, FileTransferProgress progress) throws IOException
IOException
Copyright © 2024. All rights reserved.