public final class ScpIoUtils
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.util.Set<ClientChannelEvent> |
COMMAND_WAIT_EVENTS |
| Modifier | Constructor and Description |
|---|---|
private |
ScpIoUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getExitStatusName(java.lang.Integer exitStatus) |
static void |
handleCommandExitStatus(ClientSession session,
java.lang.String cmd,
ClientChannel channel,
CommandStatusHandler handler,
org.slf4j.Logger log)
Invoked by the various
upload/download methods after having successfully completed the remote copy
command and (optionally) having received an exit status from the remote server. |
static void |
handleCommandExitStatus(ClientSession session,
java.lang.String cmd,
java.lang.Integer exitStatus,
org.slf4j.Logger log)
Invoked by the various
upload/download methods after having successfully completed the remote copy
command and (optionally) having received an exit status from the remote server |
static ChannelExec |
openCommandChannel(ClientSession session,
java.lang.String cmd,
org.slf4j.Logger log) |
static java.lang.String |
readLine(java.io.InputStream in,
java.nio.charset.Charset cs) |
static java.lang.String |
readLine(java.io.InputStream in,
java.nio.charset.Charset cs,
boolean canEof) |
static ScpAckInfo |
sendAcknowledgedCommand(AbstractScpCommandDetails cmd,
java.io.InputStream in,
java.nio.charset.Charset csIn,
java.io.OutputStream out,
java.nio.charset.Charset csOut) |
static ScpAckInfo |
sendAcknowledgedCommand(java.lang.String cmd,
java.io.InputStream in,
java.nio.charset.Charset csIn,
java.io.OutputStream out,
java.nio.charset.Charset csOut) |
static void |
writeLine(java.io.OutputStream out,
java.nio.charset.Charset cs,
java.lang.String cmd) |
public static final java.util.Set<ClientChannelEvent> COMMAND_WAIT_EVENTS
public static java.lang.String readLine(java.io.InputStream in,
java.nio.charset.Charset cs)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String readLine(java.io.InputStream in,
java.nio.charset.Charset cs,
boolean canEof)
throws java.io.IOException
java.io.IOExceptionpublic static void writeLine(java.io.OutputStream out,
java.nio.charset.Charset cs,
java.lang.String cmd)
throws java.io.IOException
java.io.IOExceptionpublic static ScpAckInfo sendAcknowledgedCommand(AbstractScpCommandDetails cmd, java.io.InputStream in, java.nio.charset.Charset csIn, java.io.OutputStream out, java.nio.charset.Charset csOut) throws java.io.IOException
java.io.IOExceptionpublic static ScpAckInfo sendAcknowledgedCommand(java.lang.String cmd, java.io.InputStream in, java.nio.charset.Charset csIn, java.io.OutputStream out, java.nio.charset.Charset csOut) throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getExitStatusName(java.lang.Integer exitStatus)
public static ChannelExec openCommandChannel(ClientSession session, java.lang.String cmd, org.slf4j.Logger log) throws java.io.IOException
java.io.IOExceptionpublic static void handleCommandExitStatus(ClientSession session, java.lang.String cmd, ClientChannel channel, CommandStatusHandler handler, org.slf4j.Logger log) throws java.io.IOException
upload/download methods after having successfully completed the remote copy
command and (optionally) having received an exit status from the remote server. If no exit status received within
CoreModuleProperties.CHANNEL_CLOSE_TIMEOUT the no further action is taken. Otherwise, the exit status is
examined to ensure it is either OK or WARNING - if not, an ScpException is thrownsession - The associated ClientSessioncmd - The attempted remote copy commandchannel - The ClientChannel through which the command was sent - Note: then channel may
be in the process of being closedhandler - The CommandStatusHandler to invoke once the exit status is received. if null
then handleCommandExitStatus(ClientSession, String, Integer, Logger) is calledlog - An optional Logger to use for issuing log messages - ignored if nulljava.io.IOException - If failed the commandpublic static void handleCommandExitStatus(ClientSession session, java.lang.String cmd, java.lang.Integer exitStatus, org.slf4j.Logger log) throws java.io.IOException
upload/download methods after having successfully completed the remote copy
command and (optionally) having received an exit status from the remote serversession - The associated ClientSessioncmd - The attempted remote copy commandexitStatus - The exit status - if null then no status was reportedlog - An optional Logger to use for issuing log messages - ignored if nulljava.io.IOException - If got a an error exit status