public class ScpHelper extends org.apache.sshd.common.util.logging.AbstractLoggingBean implements SessionHolder<Session>
| Modifier and Type | Field and Description |
|---|---|
protected Charset |
csIn |
protected Charset |
csOut |
static int |
DEFAULT_COPY_BUFFER_SIZE
Default size (in bytes) of send / receive buffer size
|
static int |
DEFAULT_RECEIVE_BUFFER_SIZE |
static int |
DEFAULT_SEND_BUFFER_SIZE |
protected FileSystem |
fileSystem |
protected InputStream |
in |
protected ScpTransferEventListener |
listener |
static int |
MIN_COPY_BUFFER_SIZE
The minimum size for sending / receiving files
|
static int |
MIN_RECEIVE_BUFFER_SIZE |
static int |
MIN_SEND_BUFFER_SIZE |
protected ScpFileOpener |
opener |
protected OutputStream |
out |
static String |
SCP_COMMAND_PREFIX
Command prefix used to identify SCP commands
|
log| Constructor and Description |
|---|
ScpHelper(Session session,
InputStream in,
Charset csIn,
OutputStream out,
Charset csOut,
FileSystem fileSystem,
ScpFileOpener opener,
ScpTransferEventListener eventListener) |
ScpHelper(Session session,
InputStream in,
OutputStream out,
FileSystem fileSystem,
ScpFileOpener opener,
ScpTransferEventListener eventListener) |
| Modifier and Type | Method and Description |
|---|---|
Session |
getSession() |
ScpAckInfo |
readAck(boolean canEof) |
String |
readLine() |
String |
readLine(boolean canEof) |
void |
receive(Path local,
boolean recursive,
boolean shouldBeDir,
boolean preserve,
int bufferSize) |
protected void |
receive(ScpReceiveLineHandler handler)
Reads command line(s) and invokes the handler until EOF or and "E" command is received
|
void |
receiveDir(String header,
Path local,
ScpTimestampCommandDetails time,
boolean preserve,
int bufferSize) |
void |
receiveFile(String header,
Path local,
ScpTimestampCommandDetails time,
boolean preserve,
int bufferSize) |
void |
receiveFileStream(OutputStream local,
int bufferSize) |
protected int |
receiveNextCmd() |
void |
receiveStream(String header,
ScpTargetStreamResolver resolver,
ScpTimestampCommandDetails time,
boolean preserve,
int bufferSize) |
Path |
resolveLocalPath(String commandPath) |
Path |
resolveLocalPath(String basedir,
String subpath) |
void |
send(Collection<String> paths,
boolean recursive,
boolean preserve,
int bufferSize) |
protected void |
send(Path local,
boolean recursive,
boolean preserve,
int bufferSize,
LinkOption... options) |
protected ScpAckInfo |
sendAcknowledgedCommand(String cmd) |
void |
sendDir(Path local,
boolean preserve,
int bufferSize) |
protected void |
sendError(String message) |
void |
sendFile(Path local,
boolean preserve,
int bufferSize) |
void |
sendOk() |
void |
sendPaths(Collection<? extends Path> paths,
boolean recursive,
boolean preserve,
int bufferSize) |
protected void |
sendResponseMessage(int level,
String message) |
void |
sendStream(ScpSourceStreamResolver resolver,
boolean preserve,
int bufferSize) |
protected void |
sendWarning(String message) |
String |
toString() |
protected void |
validateAckReplyCode(String command,
Object location,
ScpAckInfo ackInfo) |
protected void |
validateCommandStatusCode(String command,
Object location,
ScpAckInfo ackInfo,
boolean eofAllowed) |
protected void |
validateFileOperationAckReplyCode(String command,
Session session,
ScpTransferEventListener.FileOperation op,
Path file,
long fileSize,
Set<PosixFilePermission> perms,
ScpAckInfo ackInfo) |
protected void |
validateOperationReadyCode(String command,
Object location,
ScpAckInfo ackInfo) |
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSessionContextpublic static final String SCP_COMMAND_PREFIX
public static final int DEFAULT_COPY_BUFFER_SIZE
public static final int DEFAULT_RECEIVE_BUFFER_SIZE
public static final int DEFAULT_SEND_BUFFER_SIZE
public static final int MIN_COPY_BUFFER_SIZE
public static final int MIN_RECEIVE_BUFFER_SIZE
public static final int MIN_SEND_BUFFER_SIZE
protected final InputStream in
protected final Charset csIn
protected final OutputStream out
protected final Charset csOut
protected final FileSystem fileSystem
protected final ScpFileOpener opener
protected final ScpTransferEventListener listener
public ScpHelper(Session session, InputStream in, OutputStream out, FileSystem fileSystem, ScpFileOpener opener, ScpTransferEventListener eventListener)
public ScpHelper(Session session, InputStream in, Charset csIn, OutputStream out, Charset csOut, FileSystem fileSystem, ScpFileOpener opener, ScpTransferEventListener eventListener)
public Session getSession()
getSession in interface SessionHolder<Session>public void receiveFileStream(OutputStream local, int bufferSize) throws IOException
IOExceptionpublic void receive(Path local, boolean recursive, boolean shouldBeDir, boolean preserve, int bufferSize) throws IOException
IOExceptionprotected void receive(ScpReceiveLineHandler handler) throws IOException
handler - The ScpReceiveLineHandler to invoke when a command has been readIOException - If failed to read/writeprotected int receiveNextCmd()
throws IOException
IOExceptionpublic void receiveDir(String header, Path local, ScpTimestampCommandDetails time, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic void receiveFile(String header, Path local, ScpTimestampCommandDetails time, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic void receiveStream(String header, ScpTargetStreamResolver resolver, ScpTimestampCommandDetails time, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic String readLine() throws IOException
IOExceptionpublic String readLine(boolean canEof) throws IOException
IOExceptionpublic void send(Collection<String> paths, boolean recursive, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic void sendPaths(Collection<? extends Path> paths, boolean recursive, boolean preserve, int bufferSize) throws IOException
IOExceptionprotected void send(Path local, boolean recursive, boolean preserve, int bufferSize, LinkOption... options) throws IOException
IOExceptionpublic Path resolveLocalPath(String basedir, String subpath) throws IOException
IOExceptionpublic Path resolveLocalPath(String commandPath) throws IOException, InvalidPathException
commandPath - The command path using the local file separatorPathIOException - If failed to resolve the pathInvalidPathException - If invalid local path valuepublic void sendFile(Path local, boolean preserve, int bufferSize) throws IOException
IOExceptionpublic void sendStream(ScpSourceStreamResolver resolver, boolean preserve, int bufferSize) throws IOException
IOExceptionprotected void validateOperationReadyCode(String command, Object location, ScpAckInfo ackInfo) throws IOException
IOExceptionprotected void validateFileOperationAckReplyCode(String command, Session session, ScpTransferEventListener.FileOperation op, Path file, long fileSize, Set<PosixFilePermission> perms, ScpAckInfo ackInfo) throws IOException
IOExceptionprotected void validateAckReplyCode(String command, Object location, ScpAckInfo ackInfo) throws IOException
IOExceptionprotected void validateCommandStatusCode(String command, Object location, ScpAckInfo ackInfo, boolean eofAllowed) throws IOException
IOExceptionpublic void sendDir(Path local, boolean preserve, int bufferSize) throws IOException
IOExceptionprotected ScpAckInfo sendAcknowledgedCommand(String cmd) throws IOException
IOExceptionpublic void sendOk()
throws IOException
IOExceptionprotected void sendWarning(String message) throws IOException
IOExceptionprotected void sendError(String message) throws IOException
IOExceptionprotected void sendResponseMessage(int level,
String message)
throws IOException
IOExceptionpublic ScpAckInfo readAck(boolean canEof) throws IOException
IOExceptionCopyright © 2018–2021 The Apache Software Foundation. All rights reserved.