Package com.sshtools.client.scp
Class ScpClientIO.ScpEngineIO
java.lang.Object
com.sshtools.client.scp.ScpClientIO.ScpEngineIO
- Direct Known Subclasses:
ScpClient.ScpEngine
- Enclosing class:
- ScpClientIO
Implements an SCP engine.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]protected Stringprotected InputStreamprotected OutputStreamprotected SessionChannel -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedScpEngineIO(String cmd, SessionChannelNG session) Contruct the channel with the specified scp command. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the SCP engine and underlying session.protected voidparseCommand(String cmd, String[] cmdParts) Parse an SCP commandprotected voidreadCompleteFile(OutputStream out, long size, FileTransferProgress progress) protected InputStreamreadStreamFromRemote(String remoteFile, FileTransferProgress progress) Open an InputStream.protected Stringread the inputstream until come to an end of line character '\n', and return the bytes read as a stringvoidprotected voidwriteCompleteFile(InputStream in, long size, FileTransferProgress progress) protected voidwriteError(String reason) protected voidwriteOk()protected voidwriteStreamToRemote(InputStream in, long length, String localName, FileTransferProgress progress) Write a stream as a file to the remote server.
-
Field Details
-
buffer
protected byte[] buffer -
cmd
-
session
-
out
-
in
-
-
Constructor Details
-
ScpEngineIO
Contruct the channel with the specified scp command.
- Parameters:
cmd- the scp commandsession- the session to scp over- Throws:
SshException
-
-
Method Details
-
close
Close the SCP engine and underlying session.- Throws:
SshException
-
writeStreamToRemote
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.
- Parameters:
in- streamlength- number of bytes to writelocalName- local file name- Throws:
IOException- if an IO error occurs
-
readStreamFromRemote
protected InputStream readStreamFromRemote(String remoteFile, FileTransferProgress progress) throws IOException Open an InputStream.- Parameters:
remoteFile-progress-- Returns:
- ScpInputStream
- Throws:
IOException
-
parseCommand
Parse an SCP command- Parameters:
cmd-cmdParts-- Throws:
IOException
-
readString
read the inputstream until come to an end of line character '\n', and return the bytes read as a string- Returns:
- String
- Throws:
IOException
-
waitForResponse
- Throws:
IOException
-
writeOk
- Throws:
IOException
-
writeError
- Throws:
IOException
-
writeCompleteFile
protected void writeCompleteFile(InputStream in, long size, FileTransferProgress progress) throws IOException - Throws:
IOException
-
readCompleteFile
protected void readCompleteFile(OutputStream out, long size, FileTransferProgress progress) throws IOException - Throws:
IOException
-