public interface

SessionOutputBuffer

org.apache.http.nio.reactor.SessionOutputBuffer
Known Indirect Subclasses

Class Overview

Session output buffer for non-blocking connections. This interface facilitates intermediate buffering of output data streamed out to a destination channel and writing data to the buffer from a source, usually ByteBuffer or ReadableByteChannel. This interface also provides methods for writing lines of text.

Summary

Public Methods
abstract int flush(WritableByteChannel channel)
Makes an attempt to flush the content of this buffer to the given destination WritableByteChannel.
abstract boolean hasData()
Determines if the buffer contains data.
abstract int length()
Returns the length of this buffer.
abstract void write(ByteBuffer src)
Copies content of the source buffer into this buffer.
abstract void write(ReadableByteChannel src)
Reads a sequence of bytes from the source channel into this buffer.
abstract void writeLine(CharArrayBuffer src)
Copies content of the source buffer into this buffer as one line of text including a line delimiter.
abstract void writeLine(String s)
Copies content of the given string into this buffer as one line of text including a line delimiter.

Public Methods

public abstract int flush (WritableByteChannel channel)

Makes an attempt to flush the content of this buffer to the given destination WritableByteChannel.

Parameters
channel the destination channel.
Returns
  • The number of bytes written, possibly zero.
Throws
IOException in case of an I/O error.

public abstract boolean hasData ()

Determines if the buffer contains data.

Returns
  • true if there is data in the buffer, false otherwise.

public abstract int length ()

Returns the length of this buffer.

Returns
  • buffer length.

public abstract void write (ByteBuffer src)

Copies content of the source buffer into this buffer. The capacity of the destination will be expanded in order to accommodate the entire content of the source buffer.

Parameters
src the source buffer.

public abstract void write (ReadableByteChannel src)

Reads a sequence of bytes from the source channel into this buffer.

Parameters
src the source channel.
Throws
IOException

public abstract void writeLine (CharArrayBuffer src)

Copies content of the source buffer into this buffer as one line of text including a line delimiter. The capacity of the destination will be expanded in order to accommodate the entire content of the source buffer.

The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.

Parameters
src the source buffer.
Throws
CharacterCodingException

public abstract void writeLine (String s)

Copies content of the given string into this buffer as one line of text including a line delimiter. The capacity of the destination will be expanded in order to accommodate the entire string.

The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.

Parameters
s the string.
Throws
IOException