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:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel,ChannelHolder,Closeable,IoOutputStream,PacketWriter
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
Fields Modifier and Type Field Description private ChannelchannelInstanceprivate bytecmdprivate java.lang.ObjectpacketWriteIdprivate PacketWriterpacketWriterprivate java.util.concurrent.atomic.AtomicReference<IoWriteFutureImpl>pendingWrite-
Fields inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
closeFuture, futureLock, state
-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.Closeable
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description ChannelAsyncOutputStream(Channel channel, byte cmd)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CloseFuturedoCloseGracefully()protected voiddoWriteIfPossible(boolean resume)ChannelgetChannel()voidonWindowExpanded()protected voidpreClose()preClose is guaranteed to be called before doCloseGracefully or doCloseImmediately.java.lang.StringtoString()IoWriteFuturewritePacket(Buffer buffer)Encode and send the given buffer.-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, doCloseImmediately, getFutureLock, isClosed, isClosing, removeCloseFutureListener
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
getSimplifiedLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
-
-
-
Field Detail
-
channelInstance
private final Channel channelInstance
-
packetWriter
private final PacketWriter packetWriter
-
cmd
private final byte cmd
-
pendingWrite
private final java.util.concurrent.atomic.AtomicReference<IoWriteFutureImpl> pendingWrite
-
packetWriteId
private final java.lang.Object packetWriteId
-
-
Constructor Detail
-
ChannelAsyncOutputStream
public ChannelAsyncOutputStream(Channel channel, byte cmd)
-
-
Method Detail
-
getChannel
public Channel getChannel()
- Specified by:
getChannelin interfaceChannelHolder- Returns:
- The associated
Channelinstance
-
onWindowExpanded
public void onWindowExpanded() throws java.io.IOException- Throws:
java.io.IOException
-
writePacket
public IoWriteFuture writePacket(Buffer buffer) throws java.io.IOException
Description copied from interface:PacketWriterEncode and send the given buffer. Note: for session packets the buffer has to have 5 bytes free at the beginning to allow the encoding to take place. Also, the write position of the buffer has to be set to the position of the last byte to write.- Specified by:
writePacketin interfacePacketWriter- Parameters:
buffer- the buffer to encode and send. NOTE: the buffer must not be touched until the returned write future is completed.- Returns:
- An
IoWriteFuturethat can be used to check when the packet has actually been sent - Throws:
java.io.IOException- if an error occurred when encoding sending the packet
-
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
protected CloseFuture doCloseGracefully()
- Overrides:
doCloseGracefullyin classAbstractCloseable
-
doWriteIfPossible
protected void doWriteIfPossible(boolean resume)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-