Top Fields Constructors Methods
org.apache.hc.core5.http.impl.nio

pack-priv Class SessionOutputBufferImpl

extends ExpandableBuffer
implements SessionOutputBuffer
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.nio.SessionOutputBuffer
Imports
java.io.IOException, java.nio.ByteBuffer, .CharBuffer, java.nio.channels.ReadableByteChannel, .WritableByteChannel, java.nio.charset.CharacterCodingException, .Charset, .CharsetEncoder, .CoderResult, org.apache.hc.core5.http.Chars, org.apache.hc.core5.http.nio.SessionOutputBuffer, org.apache.hc.core5.util.Args, .CharArrayBuffer, .TextUtils

Field Summary

Modifier and TypeField and Description
private CharBuffer
private final CharsetEncoder
private static final byte[]
private final int

Constructor Summary

AccessConstructor and Description
public
SessionOutputBufferImpl(final int
input buffer size
bufferSize
,
final int
buffer size for line operations. Has effect only if charEncoder is not null.
lineBufferSize
,
final CharsetEncoder
charEncoder to be used for encoding HTTP protocol elements. If null simple type cast will be used for char to byte conversion.
charEncoder
)

Creates SessionOutputBufferImpl instance.

public
SessionOutputBufferImpl(final int bufferSize, final int lineBufferSize, final Charset charset)

public
SessionOutputBufferImpl(final int bufferSize, final int lineBufferSize)

public
SessionOutputBufferImpl(final int bufferSize)

Method Summary

Modifier and TypeMethod and Description
public int
public int
flush(final WritableByteChannel
the destination channel.
channel
)

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.flush.

Makes an attempt to flush the content of this buffer to the given destination WritableByteChannel.
public boolean
public int
public void
write(final ByteBuffer
the source buffer.
src
)

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.write.

Copies content of the source buffer into this buffer.
public void
write(final ReadableByteChannel
the source channel.
src
)

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.write.

Reads a sequence of bytes from the source channel into this buffer.
private void
write(final byte[] b)

private void
public void
writeLine(final CharArrayBuffer
the source buffer.
lineBuffer
)

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.writeLine.

Copies content of the source buffer into this buffer as one line of text including a line delimiter.
Inherited from org.apache.hc.core5.http.impl.nio.ExpandableBuffer:
bufferclearensureAdjustedCapacityensureCapacityexpandmodesetInputModesetOutputModetoString

Field Detail

charbufferback to summary
private CharBuffer charbuffer
charEncoderback to summary
private final CharsetEncoder charEncoder
CRLFback to summary
private static final byte[] CRLF
lineBufferSizeback to summary
private final int lineBufferSize

Constructor Detail

SessionOutputBufferImplback to summary
public SessionOutputBufferImpl(final int bufferSize, final int lineBufferSize, final CharsetEncoder charEncoder)

Creates SessionOutputBufferImpl instance.

Parameters
bufferSize:int

input buffer size

lineBufferSize:int

buffer size for line operations. Has effect only if charEncoder is not null.

charEncoder:CharsetEncoder

charEncoder to be used for encoding HTTP protocol elements. If null simple type cast will be used for char to byte conversion.

Since
4.3
SessionOutputBufferImplback to summary
public SessionOutputBufferImpl(final int bufferSize, final int lineBufferSize, final Charset charset)
Since
4.3
SessionOutputBufferImplback to summary
public SessionOutputBufferImpl(final int bufferSize, final int lineBufferSize)
Since
4.3
SessionOutputBufferImplback to summary
public SessionOutputBufferImpl(final int bufferSize)
Since
4.3

Method Detail

capacityback to summary
public int capacity()

Overrides org.apache.hc.core5.http.impl.nio.ExpandableBuffer.capacity.

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.capacity.

Doc from org.apache.hc.core5.http.nio.SessionOutputBuffer.capacity.

Returns available space in the buffer.

Returns:int

available space.

Annotations
@Override
flushback to summary
public int flush(final WritableByteChannel channel) throws IOException

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.flush.

Doc from org.apache.hc.core5.http.nio.SessionOutputBuffer.flush.

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.

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

Overrides org.apache.hc.core5.http.impl.nio.ExpandableBuffer.hasData.

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.hasData.

Doc from org.apache.hc.core5.http.nio.SessionOutputBuffer.hasData.

Determines if the buffer contains data.

Returns:boolean

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

Annotations
@Override
lengthback to summary
public int length()

Overrides org.apache.hc.core5.http.impl.nio.ExpandableBuffer.length.

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.length.

Doc from org.apache.hc.core5.http.nio.SessionOutputBuffer.length.

Returns the length of this buffer.

Returns:int

buffer length.

Annotations
@Override
writeback to summary
public void write(final ByteBuffer src)

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.write.

Doc from org.apache.hc.core5.http.nio.SessionOutputBuffer.write.

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.

Annotations
@Override
writeback to summary
public void write(final ReadableByteChannel src) throws IOException

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.write.

Doc from org.apache.hc.core5.http.nio.SessionOutputBuffer.write.

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

Parameters
src:ReadableByteChannel

the source channel.

Annotations
@Override
writeback to summary
private void write(final byte[] b)
writeCRLFback to summary
private void writeCRLF()
writeLineback to summary
public void writeLine(final CharArrayBuffer lineBuffer) throws CharacterCodingException

Implements org.apache.hc.core5.http.nio.SessionOutputBuffer.writeLine.

Doc from org.apache.hc.core5.http.nio.SessionOutputBuffer.writeLine.

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

the source buffer.

Annotations
@Override