Top Description Fields Constructors Methods
org.apache.sshd.client.channel

public abstract Class AsyncCapableClientChannel

extends AbstractClientChannel
Class Inheritance
Known Direct Subclasses
org.apache.sshd.client.channel.ChannelDirectTcpip, org.apache.sshd.client.channel.ChannelSession
Imports
java.io.IOException, .InputStream, .OutputStream, java.util.concurrent.Future, java.util.function.Supplier, org.apache.sshd.common.Closeable, .SshConstants, org.apache.sshd.common.channel.ChannelAsyncInputStream, .ChannelAsyncOutputStream, .ChannelOutputStream, .ChannelPipedInputStream, .ChannelPipedOutputStream, .LocalWindow, .RemoteWindow, org.apache.sshd.common.future.CloseFuture, .DefaultCloseFuture, org.apache.sshd.common.io.IoInputStream, .IoWriteFuture, org.apache.sshd.common.session.Session, org.apache.sshd.common.util.ValidateUtils, org.apache.sshd.common.util.threads.CloseableExecutorService, .ThreadUtils, org.apache.sshd.core.CoreModuleProperties

Channel that sets up asynchronous streams, and that pumps an input stream if set via setIn(InputStream).
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
protected Future<?>
protected CloseableExecutorService
protected final boolean
Inherited from org.apache.sshd.client.channel.AbstractClientChannel:
asyncErrasyncInasyncOuterrexitSignalHolderexitStatusHolderininvertedErrinvertedIninvertedOutopenedopenFailureLangopenFailureMsgopenFailureReasonopenFutureoutredirectErrorStreamstreaming

Constructor Summary

AccessConstructor and Description
protected
AsyncCapableClientChannel(String type, boolean withErrorStream)

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
protected void
public IoInputStream
public OutputStream
protected Closeable
public InputStream
protected void
protected int
securedRead(InputStream in, int maxChunkSize, byte[] buf, int off, int len)

public void
private <T> T
unsupported(Supplier<? extends T> err)

Inherited from org.apache.sshd.client.channel.AbstractClientChannel:
addChannelSignalRequestHandlersdoWriteDatagetAsyncIngetAsyncOutgetChannelStategetChannelTypegetExitSignalgetExitStatusgetIngetInvertedIngetInvertedOutgetOutgetStreaminghandleOpenFailurehandleOpenSuccesshandleWindowAdjustisRedirectErrorStreammayWriteopenopensetInsetOutsetRedirectErrorStreamsetStreamingupdateCurrentChannelStatewaitFor

Field Detail

pumperback to summary
protected Future<?> pumper
pumperServiceback to summary
protected CloseableExecutorService pumperService
withErrorStreamback to summary
protected final boolean withErrorStream

Constructor Detail

AsyncCapableClientChannelback to summary
protected AsyncCapableClientChannel(String type, boolean withErrorStream)

Method Detail

closeImmediately0back to summary
protected void closeImmediately0()
doOpenback to summary
protected void doOpen() throws IOException

Implements abstract org.apache.sshd.client.channel.AbstractClientChannel.doOpen.

Annotations
@Override
doWriteExtendedDataback to summary
protected void doWriteExtendedData(byte[] data, int off, long len) throws IOException

Overrides org.apache.sshd.client.channel.AbstractClientChannel.doWriteExtendedData.

Annotations
@Override
getAsyncErrback to summary
public IoInputStream getAsyncErr()

Overrides org.apache.sshd.client.channel.AbstractClientChannel.getAsyncErr.

Implements org.apache.sshd.client.channel.ClientChannel.getAsyncErr.

Annotations
@Override
getErrback to summary
public OutputStream getErr()

Overrides org.apache.sshd.client.channel.AbstractClientChannel.getErr.

Annotations
@Override
getInnerCloseableback to summary
protected Closeable getInnerCloseable()

Overrides org.apache.sshd.client.channel.AbstractClientChannel.getInnerCloseable.

Annotations
@Override
getInvertedErrback to summary
public InputStream getInvertedErr()

Overrides org.apache.sshd.client.channel.AbstractClientChannel.getInvertedErr.

Implements org.apache.sshd.client.channel.ClientChannel.getInvertedErr.

Doc from org.apache.sshd.client.channel.ClientChannel.getInvertedErr.

Obtains an InputStream to read received SshConstants#SSH_MSG_CHANNEL_EXTENDED_DATA data directly from the channel. This is an alternative to setErr(OutputStream). If the error stream is redirected to the output stream via setRedirectErrorStream(true), the returned stream will not receive any data and be always at EOF.

When the channel closes, it will not close the returned stream. It is the caller's responsibility to close the returned stream if needed. Closing the stream while the channel is open may cause the channel to be closed forcibly if more data arrives. The stream remains open after the channel has closed, so that the caller can read the last arrived data even afterwards.

As with all external processes, the application should read this stream (unless it was redirected) to avoid that the channel blocks when the stream's buffer is full. The buffer size for the returned stream is bounded by the channel's local window size. If the caller does not read this stream, the channel will block once the local window is exhausted.

This method should be called only after the channel has been opened.

Returns:InputStream

an InputStream for reading received data, or null if an output stream was set via setErr(OutputStream)

Annotations
@Override
pumpInputStreamback to summary
protected void pumpInputStream()
securedReadback to summary
protected int securedRead(InputStream in, int maxChunkSize, byte[] buf, int off, int len) throws IOException
setErrback to summary
public void setErr(OutputStream err)

Overrides org.apache.sshd.client.channel.AbstractClientChannel.setErr.

Implements org.apache.sshd.client.channel.ClientChannel.setErr.

Doc from org.apache.sshd.client.channel.ClientChannel.setErr.

Sets an output stream for the channel to write received SshConstants#SSH_MSG_CHANNEL_EXTENDED_DATA data to. For remote command execution, this is typically the remote command's stderr.

The stream must be set before the channel is opened. When the channel closes, it will close the given stream.

If no stream is set by the time the channel is opened, the channel will internally forward data to a stream that can be read via the InputStream obtained via getInvertedErr(). (Or it might forward the data to the output stream if setRedirectErrorStream(true) is set.)

Parameters
err:OutputStream

the OutputStream

Annotations
@Override
unsupportedback to summary
private <T> T unsupported(Supplier<? extends T> err)