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 com.sshtools.common.ssh.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 com.sshtools.common.ssh.SessionChannel session
protected java.io.OutputStream out
protected java.io.InputStream in
protected ScpEngineIO(java.lang.String cmd, SessionChannelNG session) throws com.sshtools.common.ssh.SshException
Contruct the channel with the specified scp command.
cmd
- the scp commandsession
- the session to scp overcom.sshtools.common.ssh.SshException
public void close() throws com.sshtools.common.ssh.SshException
com.sshtools.common.ssh.SshException
protected 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.IOException
protected void parseCommand(java.lang.String cmd, java.lang.String[] cmdParts) throws java.io.IOException
cmd
- cmdParts
- java.io.IOException
protected java.lang.String readString() throws java.io.IOException
java.io.IOException
public void waitForResponse() throws java.io.IOException
java.io.IOException
protected void writeOk() throws java.io.IOException
java.io.IOException
protected void writeError(java.lang.String reason) throws java.io.IOException
java.io.IOException
protected void writeCompleteFile(java.io.InputStream in, long size, FileTransferProgress progress) throws java.io.IOException
java.io.IOException
protected void readCompleteFile(java.io.OutputStream out, long size, FileTransferProgress progress) throws java.io.IOException
java.io.IOException
Copyright © 2023. All rights reserved.