public class BufferedIoOutputStream extends AbstractInnerCloseable implements IoOutputStream
IoOutputStream capable of queuing write requestsAbstractCloseable.State| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.atomic.AtomicReference<IoWriteFutureImpl> |
currentWrite |
protected java.lang.Object |
id |
protected IoOutputStream |
out |
protected java.util.Queue<IoWriteFutureImpl> |
writes |
closeFuture, lock, statelogCLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT| Constructor and Description |
|---|
BufferedIoOutputStream(java.lang.Object id,
IoOutputStream out) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getId() |
protected Closeable |
getInnerCloseable() |
protected void |
startWriting() |
java.lang.String |
toString() |
IoWriteFuture |
writePacket(Buffer buffer)
Encode and send the given buffer.
|
doCloseGracefully, doCloseImmediatelyaddCloseFutureListener, builder, close, isClosed, isClosing, preClose, removeCloseFutureListenergetSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListenerprotected final IoOutputStream out
protected final java.util.Queue<IoWriteFutureImpl> writes
protected final java.util.concurrent.atomic.AtomicReference<IoWriteFutureImpl> currentWrite
protected final java.lang.Object id
public BufferedIoOutputStream(java.lang.Object id,
IoOutputStream out)
public java.lang.Object getId()
public IoWriteFuture writePacket(Buffer buffer) throws java.io.IOException
PacketWriterwritePacket in interface PacketWriterbuffer - the buffer to encode and send. NOTE: the buffer must not be touched
until the returned write future is completed.IoWriteFuture that can be used to check when the packet has actually been sentjava.io.IOException - if an error occurred when encoding sending the packetprotected void startWriting()
throws java.io.IOException
java.io.IOExceptionprotected Closeable getInnerCloseable()
getInnerCloseable in class AbstractInnerCloseablepublic java.lang.String toString()
toString in class java.lang.Object