Top Description Fields Constructors Methods
org.apache.sshd.common.channel

public Class BufferedIoOutputStream

extends AbstractInnerCloseable
implements IoOutputStream, ChannelIdentifier
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.channel.ChannelIdentifier, org.apache.sshd.common.io.IoOutputStream, org.apache.sshd.common.Closeable, java.nio.channels.Channel, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.EOFException, .IOException, java.time.Duration, java.util.Objects, .Queue, java.util.concurrent.ConcurrentLinkedQueue, java.util.concurrent.atomic.AtomicInteger, .AtomicLong, .AtomicReference, org.apache.sshd.common.Closeable, .PropertyResolver, org.apache.sshd.common.channel.exception.SshChannelBufferedOutputException, org.apache.sshd.common.io.IoOutputStream, .IoWriteFuture, org.apache.sshd.common.util.ValidateUtils, org.apache.sshd.common.util.buffer.Buffer, org.apache.sshd.common.util.closeable.AbstractInnerCloseable, org.apache.sshd.common.util.functors.UnaryEquator, org.apache.sshd.core.CoreModuleProperties

An IoOutputStream capable of queuing write requests.

Field Summary

Modifier and TypeField and Description
protected final long
protected final AtomicReference<IoWriteFutureImpl>
protected final Object
protected final int
protected final Duration
protected final IoOutputStream
protected final AtomicInteger
protected final AtomicReference<SshChannelBufferedOutputException>
protected final Queue<IoWriteFutureImpl>
protected final AtomicLong

Constructor Summary

AccessConstructor and Description
public
BufferedIoOutputStream(Object id, long channelId, IoOutputStream out, PropertyResolver resolver)

public
BufferedIoOutputStream(Object id, long channelId, IoOutputStream out, int maxPendingBytesCount, Duration maxWaitForPendingWrites)

Method Summary

Modifier and TypeMethod and Description
protected void
finishWrite(IoWriteFutureImpl future, int bufferSize)

public long
public Object
protected Closeable
private IoWriteFutureImpl
protected void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

protected void
waitForAvailableWriteSpace(int requiredSize)

public IoWriteFuture
writeBuffer(Buffer
the data to write

Note

the buffer must not be touched until the returned write future is completed.

buffer
)

Implements org.apache.sshd.common.io.IoOutputStream.writeBuffer.

Write the given buffer.

Inherited from org.apache.sshd.common.util.closeable.AbstractInnerCloseable:
doCloseGracefullydoCloseImmediately

Field Detail

channelIdback to summary
protected final long channelId
currentWriteback to summary
protected final AtomicReference<IoWriteFutureImpl> currentWrite
idback to summary
protected final Object id
maxPendingBytesCountback to summary
protected final int maxPendingBytesCount
maxWaitForPendingWritesback to summary
protected final Duration maxWaitForPendingWrites
outback to summary
protected final IoOutputStream out
pendingBytesCountback to summary
protected final AtomicInteger pendingBytesCount
pendingExceptionback to summary
protected final AtomicReference<SshChannelBufferedOutputException> pendingException
writesback to summary
protected final Queue<IoWriteFutureImpl> writes
writtenBytesCountback to summary
protected final AtomicLong writtenBytesCount

Constructor Detail

BufferedIoOutputStreamback to summary
public BufferedIoOutputStream(Object id, long channelId, IoOutputStream out, PropertyResolver resolver)
BufferedIoOutputStreamback to summary
public BufferedIoOutputStream(Object id, long channelId, IoOutputStream out, int maxPendingBytesCount, Duration maxWaitForPendingWrites)

Method Detail

finishWriteback to summary
protected void finishWrite(IoWriteFutureImpl future, int bufferSize)
getChannelIdback to summary
public long getChannelId()

Implements org.apache.sshd.common.channel.ChannelIdentifier.getChannelId.

Returns:long

Doc from org.apache.sshd.common.channel.ChannelIdentifier.getChannelId.

Local channel UINT32 identifier

Annotations
@Override
getIdback to summary
public Object getId()
getInnerCloseableback to summary
protected Closeable getInnerCloseable()

Implements abstract org.apache.sshd.common.util.closeable.AbstractInnerCloseable.getInnerCloseable.

Annotations
@Override
getWriteRequestback to summary
private IoWriteFutureImpl getWriteRequest()
startWritingback to summary
protected void startWriting() throws IOException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
waitForAvailableWriteSpaceback to summary
protected void waitForAvailableWriteSpace(int requiredSize) throws IOException
writeBufferback to summary
public IoWriteFuture writeBuffer(Buffer buffer) throws IOException

Implements org.apache.sshd.common.io.IoOutputStream.writeBuffer.

Doc from org.apache.sshd.common.io.IoOutputStream.writeBuffer.

Write the given buffer.

Parameters
buffer:Buffer

the data to write

Note

the buffer must not be touched until the returned write future is completed.

Returns:IoWriteFuture

An IoWriteFuture that can be used to check when the data has actually been written.

Annotations
@Override
Exceptions
IOException:
if an error occurred when writing the data