Class ScpIoUtils

java.lang.Object
org.apache.sshd.scp.common.helpers.ScpIoUtils

public final class ScpIoUtils extends Object
Author:
Apache MINA SSHD Project
  • Field Details

    • COMMAND_WAIT_EVENTS

      public static final Set<org.apache.sshd.client.channel.ClientChannelEvent> COMMAND_WAIT_EVENTS
  • Method Details

    • 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
    • getExitStatusName

      public static String getExitStatusName(Integer exitStatus)
    • openCommandChannel

      public static org.apache.sshd.client.channel.ChannelExec openCommandChannel(org.apache.sshd.client.session.ClientSession session, String cmd, org.slf4j.Logger log) throws IOException
      Throws:
      IOException
    • handleCommandExitStatus

      public static void handleCommandExitStatus(org.apache.sshd.client.session.ClientSession session, String cmd, org.apache.sshd.client.channel.ClientChannel channel, CommandStatusHandler handler, org.slf4j.Logger log) throws IOException
      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. 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 thrown
      Parameters:
      session - The associated ClientSession
      cmd - The attempted remote copy command
      channel - The ClientChannel through which the command was sent - Note: then channel may be in the process of being closed
      handler - The CommandStatusHandler to invoke once the exit status is received. if null then handleCommandExitStatus(ClientSession, String, Integer, Logger) is called
      log - An optional Logger to use for issuing log messages - ignored if null
      Throws:
      IOException - If failed the command
    • handleCommandExitStatus

      public static void handleCommandExitStatus(org.apache.sshd.client.session.ClientSession session, String cmd, Integer exitStatus, org.slf4j.Logger log) throws IOException
      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
      Parameters:
      session - The associated ClientSession
      cmd - The attempted remote copy command
      exitStatus - The exit status - if null then no status was reported
      log - An optional Logger to use for issuing log messages - ignored if null
      Throws:
      IOException - If got a an error exit status