Class ScpIoUtils
java.lang.Object
org.apache.sshd.scp.common.helpers.ScpIoUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetExitStatusName(Integer exitStatus) static voidhandleCommandExitStatus(ClientSession session, String cmd, 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, 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, String cmd, org.slf4j.Logger log) static StringreadLine(InputStream in, Charset cs) static StringreadLine(InputStream in, Charset cs, boolean canEof) static ScpAckInfosendAcknowledgedCommand(String cmd, InputStream in, Charset csIn, OutputStream out, Charset csOut) static ScpAckInfosendAcknowledgedCommand(AbstractScpCommandDetails cmd, InputStream in, Charset csIn, OutputStream out, Charset csOut) static voidwriteLine(OutputStream out, Charset cs, String cmd)
-
Field Details
-
COMMAND_WAIT_EVENTS
-
-
Constructor Details
-
ScpIoUtils
private ScpIoUtils()
-
-
Method Details
-
readLine
- Throws:
IOException
-
readLine
- Throws:
IOException
-
writeLine
- 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
-
getExitStatusName
-
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/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:
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/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:
IOException- If got a an error exit status
-