Package org.apache.sshd.common.channel
Class BufferedIoOutputStream
- 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.util.closeable.AbstractInnerCloseable
-
- org.apache.sshd.common.channel.BufferedIoOutputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Channel
,ChannelIdentifier
,Closeable
,IoOutputStream
public class BufferedIoOutputStream extends AbstractInnerCloseable implements IoOutputStream, ChannelIdentifier
AnIoOutputStream
capable of queuing write requests.
-
-
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 protected long
channelId
protected AtomicReference<IoWriteFutureImpl>
currentWrite
protected Object
id
protected int
maxPendingBytesCount
protected Duration
maxWaitForPendingWrites
protected IoOutputStream
out
protected AtomicInteger
pendingBytesCount
protected AtomicReference<SshChannelBufferedOutputException>
pendingException
protected Queue<IoWriteFutureImpl>
writes
protected AtomicLong
writtenBytesCount
-
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
-
-
Constructor Summary
Constructors Constructor Description BufferedIoOutputStream(Object id, long channelId, IoOutputStream out, int maxPendingBytesCount, Duration maxWaitForPendingWrites)
BufferedIoOutputStream(Object id, long channelId, IoOutputStream out, PropertyResolver resolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finishWrite(IoWriteFutureImpl future, int bufferSize)
long
getChannelId()
Object
getId()
protected Closeable
getInnerCloseable()
protected void
startWriting()
String
toString()
protected void
waitForAvailableWriteSpace(int requiredSize)
IoWriteFuture
writeBuffer(Buffer buffer)
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediately
-
Methods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListener
-
Methods 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, warn
-
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
-
id
protected final Object id
-
channelId
protected final long channelId
-
maxPendingBytesCount
protected final int maxPendingBytesCount
-
maxWaitForPendingWrites
protected final Duration maxWaitForPendingWrites
-
out
protected final IoOutputStream out
-
pendingBytesCount
protected final AtomicInteger pendingBytesCount
-
writtenBytesCount
protected final AtomicLong writtenBytesCount
-
writes
protected final Queue<IoWriteFutureImpl> writes
-
currentWrite
protected final AtomicReference<IoWriteFutureImpl> currentWrite
-
pendingException
protected final AtomicReference<SshChannelBufferedOutputException> pendingException
-
-
Constructor Detail
-
BufferedIoOutputStream
public BufferedIoOutputStream(Object id, long channelId, IoOutputStream out, PropertyResolver resolver)
-
BufferedIoOutputStream
public BufferedIoOutputStream(Object id, long channelId, IoOutputStream out, int maxPendingBytesCount, Duration maxWaitForPendingWrites)
-
-
Method Detail
-
getChannelId
public long getChannelId()
- Specified by:
getChannelId
in interfaceChannelIdentifier
- Returns:
- Local channel UINT32 identifier
-
getId
public Object getId()
-
writeBuffer
public IoWriteFuture writeBuffer(Buffer buffer) throws IOException
- Specified by:
writeBuffer
in interfaceIoOutputStream
- Throws:
IOException
-
waitForAvailableWriteSpace
protected void waitForAvailableWriteSpace(int requiredSize) throws IOException
- Throws:
IOException
-
startWriting
protected void startWriting() throws IOException
- Throws:
IOException
-
finishWrite
protected void finishWrite(IoWriteFutureImpl future, int bufferSize)
-
getInnerCloseable
protected Closeable getInnerCloseable()
- Specified by:
getInnerCloseable
in classAbstractInnerCloseable
-
-