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,Closeable,IoOutputStream
An
IoOutputStream 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
FieldsModifier and TypeFieldDescriptionprotected final intprotected final AtomicReference<IoWriteFutureImpl>protected final Objectprotected final intprotected final Durationprotected final IoOutputStreamprotected final AtomicIntegerprotected final AtomicReference<SshChannelBufferedOutputException>protected final Queue<IoWriteFutureImpl>protected final AtomicLongFields 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
ConstructorsConstructorDescriptionBufferedIoOutputStream(Object id, int channelId, IoOutputStream out, int maxPendingBytesCount, Duration maxWaitForPendingWrites) BufferedIoOutputStream(Object id, int channelId, IoOutputStream out, PropertyResolver resolver) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfinishWrite(IoWriteFutureImpl future, int bufferSize) getId()protected Closeableprotected voidtoString()protected voidwaitForAvailableWriteSpace(int requiredSize) writeBuffer(Buffer buffer) Write the given buffer.Methods inherited from class org.apache.sshd.common.util.closeable.AbstractInnerCloseable
doCloseGracefully, doCloseImmediatelyMethods inherited from class org.apache.sshd.common.util.closeable.AbstractCloseable
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, 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
-
id
-
channelId
protected final int channelId -
maxPendingBytesCount
protected final int maxPendingBytesCount -
maxWaitForPendingWrites
-
out
-
pendingBytesCount
-
writtenBytesCount
-
writes
-
currentWrite
-
pendingException
-
-
Constructor Details
-
BufferedIoOutputStream
public BufferedIoOutputStream(Object id, int channelId, IoOutputStream out, PropertyResolver resolver) -
BufferedIoOutputStream
public BufferedIoOutputStream(Object id, int channelId, IoOutputStream out, int maxPendingBytesCount, Duration maxWaitForPendingWrites)
-
-
Method Details
-
getId
-
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
-
waitForAvailableWriteSpace
- Throws:
IOException
-
startWriting
- Throws:
IOException
-
finishWrite
-
getInnerCloseable
- Specified by:
getInnerCloseablein classAbstractInnerCloseable
-
toString
-