Package org.apache.sshd.common.channel
Class ChannelAsyncOutputStream
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.util.closeable.IoBaseCloseable
org.apache.sshd.common.util.closeable.AbstractCloseable
org.apache.sshd.common.channel.ChannelAsyncOutputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,ChannelHolder,Closeable,IoOutputStream
public class ChannelAsyncOutputStream
extends AbstractCloseable
implements IoOutputStream, ChannelHolder
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
AbstractCloseable.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Channelprivate final byteprivate final Objectprivate final ChannelStreamWriterprivate final AtomicReference<IoWriteFutureImpl>private booleanFields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, stateFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionChannelAsyncOutputStream(Channel channel, byte cmd) ChannelAsyncOutputStream(Channel channel, byte cmd, boolean sendChunkIfRemoteWindowIsSmallerThanPacketSize) -
Method Summary
Modifier and TypeMethodDescriptionprotected BuffercreateSendBuffer(Buffer buffer, Channel channel, long length) protected CloseFutureprotected voiddoWriteIfPossible(boolean resume) bytebooleanvoidprotected voidonWritten(IoWriteFutureImpl future, int total, long length, IoWriteFuture f) protected voidpreClose()preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately.voidsetSendChunkIfRemoteWindowIsSmallerThanPacketSize(boolean sendChunkIfRemoteWindowIsSmallerThanPacketSize) toString()writeBuffer(Buffer buffer) Write the given buffer.Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, doCloseImmediately, getFutureLock, isClosed, isClosing, removeCloseFutureListenerMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Field Details
-
channelInstance
-
packetWriter
-
cmd
private final byte cmd -
pendingWrite
-
packetWriteId
-
sendChunkIfRemoteWindowIsSmallerThanPacketSize
private boolean sendChunkIfRemoteWindowIsSmallerThanPacketSize
-
-
Constructor Details
-
ChannelAsyncOutputStream
- Parameters:
channel- TheChannelthrough which the stream is communicatingcmd- EitherSSH_MSG_CHANNEL_DATAorSSH_MSG_CHANNEL_EXTENDED_DATAindicating the output stream type
-
ChannelAsyncOutputStream
public ChannelAsyncOutputStream(Channel channel, byte cmd, boolean sendChunkIfRemoteWindowIsSmallerThanPacketSize) - Parameters:
channel- TheChannelthrough which the stream is communicatingcmd- EitherSSH_MSG_CHANNEL_DATAorSSH_MSG_CHANNEL_EXTENDED_DATAindicating the output stream typesendChunkIfRemoteWindowIsSmallerThanPacketSize- Determines the chunking behaviour, if the remote window size is smaller than the packet size. Can be used to establish compatibility with certain clients, that wait until the window size is 0 before adjusting it.- See Also:
-
-
Method Details
-
getChannel
- Specified by:
getChannelin interfaceChannelHolder- Returns:
- The associated
Channelinstance
-
getCommandType
public byte getCommandType()- Returns:
- Either
SSH_MSG_CHANNEL_DATAorSSH_MSG_CHANNEL_EXTENDED_DATAindicating the output stream type
-
onWindowExpanded
- Throws:
IOException
-
writeBuffer
Description copied from interface:IoOutputStreamWrite the given buffer.- Specified by:
writeBufferin interfaceIoOutputStream- Parameters:
buffer- the data to write. NOTE: the buffer must not be touched until the returned write future is completed.- Returns:
- An
IoWriteFuturethat can be used to check when the data has actually been written. - Throws:
IOException- if an error occurred when writing the data
-
preClose
protected void preClose()Description copied from class:AbstractCloseablepreClose is guaranteed to be called before doCloseGracefully or doCloseImmediately. When preClose() is called, isClosing() == true- Overrides:
preClosein classAbstractCloseable
-
doCloseGracefully
- Overrides:
doCloseGracefullyin classAbstractCloseable
-
doWriteIfPossible
protected void doWriteIfPossible(boolean resume) -
onWritten
-
createSendBuffer
-
toString
-
isSendChunkIfRemoteWindowIsSmallerThanPacketSize
public boolean isSendChunkIfRemoteWindowIsSmallerThanPacketSize() -
setSendChunkIfRemoteWindowIsSmallerThanPacketSize
public void setSendChunkIfRemoteWindowIsSmallerThanPacketSize(boolean sendChunkIfRemoteWindowIsSmallerThanPacketSize)
-