public class BufferedIoOutputStream extends AbstractInnerCloseable implements IoOutputStream, ChannelIdentifier
IoOutputStream capable of queuing write requests.AbstractCloseable.State| Modifier and Type | Field and Description |
|---|---|
protected long |
channelId |
protected java.util.concurrent.atomic.AtomicReference<IoWriteFutureImpl> |
currentWrite |
protected java.lang.Object |
id |
protected int |
maxPendingBytesCount |
protected java.time.Duration |
maxWaitForPendingWrites |
protected IoOutputStream |
out |
protected java.util.concurrent.atomic.AtomicInteger |
pendingBytesCount |
protected java.util.concurrent.atomic.AtomicReference<SshChannelBufferedOutputException> |
pendingException |
protected java.util.Queue<IoWriteFutureImpl> |
writes |
protected java.util.concurrent.atomic.AtomicLong |
writtenBytesCount |
closeFuture, futureLock, statelog| Constructor and Description |
|---|
BufferedIoOutputStream(java.lang.Object id,
long channelId,
IoOutputStream out,
int maxPendingBytesCount,
java.time.Duration maxWaitForPendingWrites) |
BufferedIoOutputStream(java.lang.Object id,
long channelId,
IoOutputStream out,
PropertyResolver resolver) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
finishWrite(IoWriteFutureImpl future,
int bufferSize) |
long |
getChannelId() |
java.lang.Object |
getId() |
protected Closeable |
getInnerCloseable() |
private IoWriteFutureImpl |
getWriteRequest() |
protected void |
startWriting() |
java.lang.String |
toString() |
protected void |
waitForAvailableWriteSpace(int requiredSize) |
IoWriteFuture |
writeBuffer(Buffer buffer)
Write the given buffer.
|
doCloseGracefully, doCloseImmediatelyaddCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListenerdebug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListenerprotected final java.lang.Object id
protected final long channelId
protected final int maxPendingBytesCount
protected final java.time.Duration maxWaitForPendingWrites
protected final IoOutputStream out
protected final java.util.concurrent.atomic.AtomicInteger pendingBytesCount
protected final java.util.concurrent.atomic.AtomicLong writtenBytesCount
protected final java.util.Queue<IoWriteFutureImpl> writes
protected final java.util.concurrent.atomic.AtomicReference<IoWriteFutureImpl> currentWrite
protected final java.util.concurrent.atomic.AtomicReference<SshChannelBufferedOutputException> pendingException
public BufferedIoOutputStream(java.lang.Object id,
long channelId,
IoOutputStream out,
PropertyResolver resolver)
public BufferedIoOutputStream(java.lang.Object id,
long channelId,
IoOutputStream out,
int maxPendingBytesCount,
java.time.Duration maxWaitForPendingWrites)
public long getChannelId()
getChannelId in interface ChannelIdentifierpublic java.lang.Object getId()
public IoWriteFuture writeBuffer(Buffer buffer) throws java.io.IOException
IoOutputStreamwriteBuffer in interface IoOutputStreambuffer - the data to write. NOTE: the buffer must not be touched until the returned write
future is completed.IoWriteFuture that can be used to check when the data has actually been written.java.io.IOException - if an error occurred when writing the dataprotected void waitForAvailableWriteSpace(int requiredSize)
throws java.io.IOException
java.io.IOExceptionprivate IoWriteFutureImpl getWriteRequest()
protected void startWriting()
throws java.io.IOException
java.io.IOExceptionprotected void finishWrite(IoWriteFutureImpl future, int bufferSize)
protected Closeable getInnerCloseable()
getInnerCloseable in class AbstractInnerCloseablepublic java.lang.String toString()
toString in class java.lang.Object