Class ScpIoUtils
- java.lang.Object
-
- org.apache.sshd.scp.common.helpers.ScpIoUtils
-
public final class ScpIoUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<ClientChannelEvent>COMMAND_WAIT_EVENTS
-
Constructor Summary
Constructors Modifier Constructor Description privateScpIoUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetExitStatusName(java.lang.Integer exitStatus)static voidhandleCommandExitStatus(ClientSession session, java.lang.String cmd, java.lang.Integer exitStatus, org.slf4j.Logger log)Invoked by the variousupload/downloadmethods after having successfully completed the remote copy command and (optionally) having received an exit status from the remote serverstatic voidhandleCommandExitStatus(ClientSession session, java.lang.String cmd, ClientChannel channel, CommandStatusHandler handler, org.slf4j.Logger log)Invoked by the variousupload/downloadmethods after having successfully completed the remote copy command and (optionally) having received an exit status from the remote server.static ChannelExecopenCommandChannel(ClientSession session, java.lang.String cmd, org.slf4j.Logger log)static java.lang.StringreadLine(java.io.InputStream in)static java.lang.StringreadLine(java.io.InputStream in, boolean canEof)static ScpAckInfosendAcknowledgedCommand(java.lang.String cmd, java.io.InputStream in, java.io.OutputStream out)static ScpAckInfosendAcknowledgedCommand(AbstractScpCommandDetails cmd, java.io.InputStream in, java.io.OutputStream out)static voidwriteLine(java.io.OutputStream out, java.lang.String cmd)
-
-
-
Field Detail
-
COMMAND_WAIT_EVENTS
public static final java.util.Set<ClientChannelEvent> COMMAND_WAIT_EVENTS
-
-
Method Detail
-
readLine
public static java.lang.String readLine(java.io.InputStream in) throws java.io.IOException- Throws:
java.io.IOException
-
readLine
public static java.lang.String readLine(java.io.InputStream in, boolean canEof) throws java.io.IOException- Throws:
java.io.IOException
-
writeLine
public static void writeLine(java.io.OutputStream out, java.lang.String cmd) throws java.io.IOException- Throws:
java.io.IOException
-
sendAcknowledgedCommand
public static ScpAckInfo sendAcknowledgedCommand(AbstractScpCommandDetails cmd, java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
sendAcknowledgedCommand
public static ScpAckInfo sendAcknowledgedCommand(java.lang.String cmd, java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
getExitStatusName
public static java.lang.String getExitStatusName(java.lang.Integer exitStatus)
-
openCommandChannel
public static ChannelExec openCommandChannel(ClientSession session, java.lang.String cmd, org.slf4j.Logger log) throws java.io.IOException
- Throws:
java.io.IOException
-
handleCommandExitStatus
public static void handleCommandExitStatus(ClientSession session, java.lang.String cmd, ClientChannel channel, CommandStatusHandler handler, org.slf4j.Logger log) throws java.io.IOException
Invoked by the variousupload/downloadmethods 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_TIMEOUTthe no further action is taken. Otherwise, the exit status is examined to ensure it is either OK or WARNING - if not, anScpExceptionis thrown- Parameters:
session- The associatedClientSessioncmd- The attempted remote copy commandchannel- TheClientChannelthrough which the command was sent - Note: then channel may be in the process of being closedhandler- TheCommandStatusHandlerto invoke once the exit status is received. ifnullthenhandleCommandExitStatus(ClientSession, String, Integer, Logger)is calledlog- An optionalLoggerto use for issuing log messages - ignored ifnull- Throws:
java.io.IOException- If failed the command
-
handleCommandExitStatus
public static void handleCommandExitStatus(ClientSession session, java.lang.String cmd, java.lang.Integer exitStatus, org.slf4j.Logger log) throws java.io.IOException
Invoked by the variousupload/downloadmethods after having successfully completed the remote copy command and (optionally) having received an exit status from the remote server- Parameters:
session- The associatedClientSessioncmd- The attempted remote copy commandexitStatus- The exit status - ifnullthen no status was reportedlog- An optionalLoggerto use for issuing log messages - ignored ifnull- Throws:
java.io.IOException- If got a an error exit status
-
-