Class ScpIoUtils
- java.lang.Object
-
- org.apache.sshd.scp.common.helpers.ScpIoUtils
-
public final class ScpIoUtils extends Object
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static Set<ClientChannelEvent>
COMMAND_WAIT_EVENTS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getExitStatusName(Integer exitStatus)
static void
handleCommandExitStatus(ClientSession session, String cmd, Integer exitStatus, org.slf4j.Logger log)
Invoked by the variousupload/download
methods after having successfully completed the remote copy command and (optionally) having received an exit status from the remote serverstatic void
handleCommandExitStatus(ClientSession session, String cmd, ClientChannel channel, CommandStatusHandler handler, org.slf4j.Logger log)
Invoked by the variousupload/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, String cmd, org.slf4j.Logger log)
static String
readLine(InputStream in, Charset cs)
static String
readLine(InputStream in, Charset cs, boolean canEof)
static ScpAckInfo
sendAcknowledgedCommand(String cmd, InputStream in, Charset csIn, OutputStream out, Charset csOut)
static ScpAckInfo
sendAcknowledgedCommand(AbstractScpCommandDetails cmd, InputStream in, Charset csIn, OutputStream out, Charset csOut)
static void
writeLine(OutputStream out, Charset cs, String cmd)
-
-
-
Field Detail
-
COMMAND_WAIT_EVENTS
public static final Set<ClientChannelEvent> COMMAND_WAIT_EVENTS
-
-
Method Detail
-
readLine
public static String readLine(InputStream in, Charset cs) throws IOException
- Throws:
IOException
-
readLine
public static String readLine(InputStream in, Charset cs, boolean canEof) throws IOException
- Throws:
IOException
-
writeLine
public static void writeLine(OutputStream out, Charset cs, String cmd) throws IOException
- Throws:
IOException
-
sendAcknowledgedCommand
public static ScpAckInfo sendAcknowledgedCommand(AbstractScpCommandDetails cmd, InputStream in, Charset csIn, OutputStream out, Charset csOut) throws IOException
- Throws:
IOException
-
sendAcknowledgedCommand
public static ScpAckInfo sendAcknowledgedCommand(String cmd, InputStream in, Charset csIn, OutputStream out, Charset csOut) throws IOException
- Throws:
IOException
-
openCommandChannel
public static ChannelExec openCommandChannel(ClientSession session, String cmd, org.slf4j.Logger log) throws IOException
- Throws:
IOException
-
handleCommandExitStatus
public static void handleCommandExitStatus(ClientSession session, String cmd, ClientChannel channel, CommandStatusHandler handler, org.slf4j.Logger log) throws IOException
Invoked by the variousupload/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 withinCoreModuleProperties.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, anScpException
is thrown- Parameters:
session
- The associatedClientSession
cmd
- The attempted remote copy commandchannel
- TheClientChannel
through which the command was sent - Note: then channel may be in the process of being closedhandler
- TheCommandStatusHandler
to invoke once the exit status is received. ifnull
thenhandleCommandExitStatus(ClientSession, String, Integer, Logger)
is calledlog
- An optionalLogger
to use for issuing log messages - ignored ifnull
- Throws:
IOException
- If failed the command
-
handleCommandExitStatus
public static void handleCommandExitStatus(ClientSession session, String cmd, Integer exitStatus, org.slf4j.Logger log) throws IOException
Invoked by the variousupload/download
methods after having successfully completed the remote copy command and (optionally) having received an exit status from the remote server- Parameters:
session
- The associatedClientSession
cmd
- The attempted remote copy commandexitStatus
- The exit status - ifnull
then no status was reportedlog
- An optionalLogger
to use for issuing log messages - ignored ifnull
- Throws:
IOException
- If got a an error exit status
-
-