Top Fields Constructors Methods
org.apache.sshd.scp.common.helpers

public final Class ScpIoUtils

extends Object
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .EOFException, .IOException, .InputStream, .OutputStream, java.nio.charset.Charset, java.time.Duration, java.util.Collection, .Collections, .EnumSet, .Set, org.apache.sshd.client.channel.ChannelExec, .ClientChannel, .ClientChannelEvent, org.apache.sshd.client.session.ClientSession, org.apache.sshd.common.util.GenericUtils, org.apache.sshd.core.CoreModuleProperties, org.apache.sshd.scp.ScpModuleProperties, org.apache.sshd.scp.common.ScpException, org.slf4j.Logger

Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final Set<ClientChannelEvent>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static String
public static void
handleCommandExitStatus(ClientSession
The associated ClientSession
session
,
String
The attempted remote copy command
cmd
,
ClientChannel
The ClientChannel through which the command was sent - Note: then channel may be in the process of being closed
channel
,
CommandStatusHandler
The CommandStatusHandler to invoke once the exit status is received. if null then handleCommandExitStatus(ClientSession, String, Integer, Logger) is called
handler
,
Logger
An optional Logger to use for issuing log messages - ignored if null
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.

public static void
handleCommandExitStatus(ClientSession
The associated ClientSession
session
,
String
The attempted remote copy command
cmd
,
Integer
The exit status - if null then no status was reported
exitStatus
,
Logger
An optional Logger to use for issuing log messages - ignored if null
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

public static ChannelExec
public static String
public static String
readLine(InputStream in, Charset cs, boolean canEof)

public static ScpAckInfo
public static ScpAckInfo
public static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COMMAND_WAIT_EVENTSback to summary
public static final Set<ClientChannelEvent> COMMAND_WAIT_EVENTS

Constructor Detail

ScpIoUtilsback to summary
private ScpIoUtils()

Method Detail

getExitStatusNameback to summary
public static String getExitStatusName(Integer exitStatus)
handleCommandExitStatusback to summary
public static void handleCommandExitStatus(ClientSession session, String cmd, ClientChannel channel, CommandStatusHandler handler, 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:ClientSession

The associated ClientSession

cmd:String

The attempted remote copy command

channel:ClientChannel

The ClientChannel through which the command was sent - Note: then channel may be in the process of being closed

handler:CommandStatusHandler

The CommandStatusHandler to invoke once the exit status is received. if null then handleCommandExitStatus(ClientSession, String, Integer, Logger) is called

log:Logger

An optional Logger to use for issuing log messages - ignored if null

Exceptions
IOException:
If failed the command
handleCommandExitStatusback to summary
public static void handleCommandExitStatus(ClientSession session, String cmd, Integer exitStatus, 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:ClientSession

The associated ClientSession

cmd:String

The attempted remote copy command

exitStatus:Integer

The exit status - if null then no status was reported

log:Logger

An optional Logger to use for issuing log messages - ignored if null

Exceptions
IOException:
If got a an error exit status
openCommandChannelback to summary
public static ChannelExec openCommandChannel(ClientSession session, String cmd, Logger log) throws IOException
readLineback to summary
public static String readLine(InputStream in, Charset cs) throws IOException
readLineback to summary
public static String readLine(InputStream in, Charset cs, boolean canEof) throws IOException
sendAcknowledgedCommandback to summary
public static ScpAckInfo sendAcknowledgedCommand(AbstractScpCommandDetails cmd, InputStream in, Charset csIn, OutputStream out, Charset csOut) throws IOException
sendAcknowledgedCommandback to summary
public static ScpAckInfo sendAcknowledgedCommand(String cmd, InputStream in, Charset csIn, OutputStream out, Charset csOut) throws IOException
writeLineback to summary
public static void writeLine(OutputStream out, Charset cs, String cmd) throws IOException