Top Description Methods
org.apache.hc.core5.http.nio

public Interface SessionOutputBuffer

Known Direct Implementers
org.apache.hc.core5.http.impl.nio.SessionOutputBufferImpl
Imports
java.io.IOException, java.nio.ByteBuffer, java.nio.channels.ReadableByteChannel, .WritableByteChannel, java.nio.charset.CharacterCodingException, org.apache.hc.core5.util.CharArrayBuffer

Session output buffer for non-blocking HTTP/1.1 connections.

This interface facilitates intermediate buffering of output data streamed out to a destination channel and provides provides methods for writing lines of text.

Since
4.0

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

available space.
capacity
()

Returns available space in the buffer.

public int

Returns:

The number of bytes written, possibly zero.
flush
(WritableByteChannel
the destination channel.
channel
)

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

public boolean

Returns:

true if there is data in the buffer, false otherwise.
hasData
()

Determines if the buffer contains data.

public int

Returns:

buffer length.
length
()

Returns the length of this buffer.

public void
write(ByteBuffer
the source buffer.
src
)

Copies content of the source buffer into this buffer.

public void
write(ReadableByteChannel
the source channel.
src
)

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

public void
writeLine(CharArrayBuffer
the source buffer.
src
)

Copies content of the source buffer into this buffer as one line of text including a line delimiter.

Method Detail

capacityback to summary
public int capacity()

Returns available space in the buffer.

Returns:int

available space.

flushback to summary
public int flush(WritableByteChannel channel) throws IOException

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

Parameters
channel:WritableByteChannel

the destination channel.

Returns:int

The number of bytes written, possibly zero.

Exceptions
IOException:
in case of an I/O error.
hasDataback to summary
public boolean hasData()

Determines if the buffer contains data.

Returns:boolean

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

lengthback to summary
public int length()

Returns the length of this buffer.

Returns:int

buffer length.

writeback to summary
public 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:ByteBuffer

the source buffer.

writeback to summary
public void write(ReadableByteChannel src) throws IOException

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

Parameters
src:ReadableByteChannel

the source channel.

writeLineback to summary
public void writeLine(CharArrayBuffer src) throws CharacterCodingException

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:CharArrayBuffer

the source buffer.