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 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 |
closeFuture, futureLock, state
log
Constructor and Description |
---|
BufferedIoOutputStream(Object id,
long channelId,
IoOutputStream out,
int maxPendingBytesCount,
Duration maxWaitForPendingWrites) |
BufferedIoOutputStream(Object id,
long channelId,
IoOutputStream out,
PropertyResolver resolver) |
Modifier and Type | Method and 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)
Write the given buffer.
|
doCloseGracefully, doCloseImmediately
addCloseFutureListener, builder, close, getFutureLock, isClosed, isClosing, preClose, removeCloseFutureListener
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addCloseFutureListener, close, close, close, getMaxCloseWaitTime, isClosed, isClosing, isOpen, removeCloseFutureListener
protected final Object id
protected final long channelId
protected final int maxPendingBytesCount
protected final Duration maxWaitForPendingWrites
protected final IoOutputStream out
protected final AtomicInteger pendingBytesCount
protected final AtomicLong writtenBytesCount
protected final Queue<IoWriteFutureImpl> writes
protected final AtomicReference<IoWriteFutureImpl> currentWrite
protected final AtomicReference<SshChannelBufferedOutputException> pendingException
public BufferedIoOutputStream(Object id, long channelId, IoOutputStream out, PropertyResolver resolver)
public BufferedIoOutputStream(Object id, long channelId, IoOutputStream out, int maxPendingBytesCount, Duration maxWaitForPendingWrites)
public long getChannelId()
getChannelId
in interface ChannelIdentifier
public Object getId()
public IoWriteFuture writeBuffer(Buffer buffer) throws IOException
IoOutputStream
writeBuffer
in interface IoOutputStream
buffer
- 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.IOException
- if an error occurred when writing the dataprotected void waitForAvailableWriteSpace(int requiredSize) throws IOException
IOException
protected void startWriting() throws IOException
IOException
protected void finishWrite(IoWriteFutureImpl future, int bufferSize)
protected Closeable getInnerCloseable()
getInnerCloseable
in class AbstractInnerCloseable
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.