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

pack-priv Class SessionInputBufferImpl

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

Field Summary

Modifier and TypeField and Description
private CharBuffer
private final CharsetDecoder
private final int
private final int

Constructor Summary

AccessConstructor and Description
public
SessionInputBufferImpl(final int
input buffer size
bufferSize
,
final int
buffer size for line operations. Has effect only if charDecoder is not null.
lineBuffersize
,
final int
maximum line length.
maxLineLen
,
final CharsetDecoder
charDecoder to be used for decoding HTTP protocol elements. If null simple type cast will be used for byte to char conversion.
charDecoder
)

Creates SessionInputBufferImpl instance.

public
SessionInputBufferImpl(final int bufferSize, final int lineBuffersize, final int maxLineLen, final Charset charset)

public
SessionInputBufferImpl(final int bufferSize, final int lineBuffersize, final int maxLineLen)

public
SessionInputBufferImpl(final int bufferSize, final int lineBuffersize)

public
SessionInputBufferImpl(final int bufferSize)

Method Summary

Modifier and TypeMethod and Description
public int
capacity()

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

Returns available capacity of this buffer.
public int
fill(final ReadableByteChannel
the source channel
channel
)

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.fill.

Makes an attempt to fill the buffer with data from the given ReadableByteChannel.
public boolean
public int
public void
put(final ByteBuffer src)

public int
read()

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Reads one byte from the buffer.
public int
read(final ByteBuffer
the destination buffer.
dst
,
final int
the maximum number of bytes to be read.
maxLen
)

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Reads a sequence of bytes from this buffer into the destination buffer, up to the given maximum limit.
public int
read(final ByteBuffer
the destination buffer.
dst
)

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Reads a sequence of bytes from this buffer into the destination buffer.
public int
read(final WritableByteChannel
the destination channel.
dst
,
final int
the maximum number of bytes to be read.
maxLen
)

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Reads a sequence of bytes from this buffer into the destination channel, up to the given maximum limit.
public int
read(final WritableByteChannel
the destination channel.
dst
)

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Reads a sequence of bytes from this buffer into the destination channel.
public boolean
readLine(final CharArrayBuffer
the destination buffer.
lineBuffer
,
final boolean
end of stream flag
endOfStream
)

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.readLine.

Attempts to transfer a complete line of characters up to a line delimiter from this buffer to the destination buffer.
Inherited from org.apache.hc.core5.http.impl.nio.ExpandableBuffer:
bufferclearensureAdjustedCapacityensureCapacityexpandmodesetInputModesetOutputModetoString

Field Detail

charbufferback to summary
private CharBuffer charbuffer
charDecoderback to summary
private final CharsetDecoder charDecoder
lineBuffersizeback to summary
private final int lineBuffersize
maxLineLenback to summary
private final int maxLineLen

Constructor Detail

SessionInputBufferImplback to summary
public SessionInputBufferImpl(final int bufferSize, final int lineBuffersize, final int maxLineLen, final CharsetDecoder charDecoder)

Creates SessionInputBufferImpl instance.

Parameters
bufferSize:int

input buffer size

lineBuffersize:int

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

maxLineLen:int

maximum line length.

charDecoder:CharsetDecoder

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

Since
4.4
SessionInputBufferImplback to summary
public SessionInputBufferImpl(final int bufferSize, final int lineBuffersize, final int maxLineLen, final Charset charset)
Since
4.3
SessionInputBufferImplback to summary
public SessionInputBufferImpl(final int bufferSize, final int lineBuffersize, final int maxLineLen)
Since
4.3
SessionInputBufferImplback to summary
public SessionInputBufferImpl(final int bufferSize, final int lineBuffersize)
Since
4.3
SessionInputBufferImplback to summary
public SessionInputBufferImpl(final int bufferSize)
Since
4.3

Method Detail

capacityback to summary
public int capacity()

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

Doc from org.apache.hc.core5.http.impl.nio.ExpandableBuffer.capacity.

Returns available capacity of this buffer.

Returns:int

buffer length.

Annotations
@Override
fillback to summary
public int fill(final ReadableByteChannel channel) throws IOException

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.fill.

Doc from org.apache.hc.core5.http.nio.SessionInputBuffer.fill.

Makes an attempt to fill the buffer with data from the given ReadableByteChannel.

Parameters
channel:ReadableByteChannel

the source channel

Returns:int

The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream.

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.SessionInputBuffer.hasData.

Doc from org.apache.hc.core5.http.nio.SessionInputBuffer.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.SessionInputBuffer.length.

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

Returns the length of this buffer.

Returns:int

buffer length.

Annotations
@Override
putback to summary
public void put(final ByteBuffer src)
readback to summary
public int read()

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Doc from org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Reads one byte from the buffer. If the buffer is empty this method can throw a runtime exception. The exact type of runtime exception thrown by this method depends on implementation.

Returns:int

one byte

Annotations
@Override
readback to summary
public int read(final ByteBuffer dst, final int maxLen)

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Doc from org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Reads a sequence of bytes from this buffer into the destination buffer, up to the given maximum limit. The exact number of bytes transferred depends on availability of data in this buffer and capacity of the destination buffer, but cannot be more than maxLen value.

Parameters
dst:ByteBuffer

the destination buffer.

maxLen:int

the maximum number of bytes to be read.

Returns:int

The number of bytes read, possibly zero.

Annotations
@Override
readback to summary
public int read(final ByteBuffer dst)

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Doc from org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Reads a sequence of bytes from this buffer into the destination buffer. The exact number of bytes transferred depends on availability of data in this buffer and capacity of the destination buffer.

Parameters
dst:ByteBuffer

the destination buffer.

Returns:int

The number of bytes read, possibly zero.

Annotations
@Override
readback to summary
public int read(final WritableByteChannel dst, final int maxLen) throws IOException

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Doc from org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Reads a sequence of bytes from this buffer into the destination channel, up to the given maximum limit. The exact number of bytes transferred depends on availability of data in this buffer, but cannot be more than maxLen value.

Parameters
dst:WritableByteChannel

the destination channel.

maxLen:int

the maximum number of bytes to be read.

Returns:int

The number of bytes read, possibly zero.

Annotations
@Override
Exceptions
IOException:
in case of an I/O error.
readback to summary
public int read(final WritableByteChannel dst) throws IOException

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Doc from org.apache.hc.core5.http.nio.SessionInputBuffer.read.

Reads a sequence of bytes from this buffer into the destination channel. The exact number of bytes transferred depends on availability of data in this buffer.

Parameters
dst:WritableByteChannel

the destination channel.

Returns:int

The number of bytes read, possibly zero.

Annotations
@Override
Exceptions
IOException:
in case of an I/O error.
readLineback to summary
public boolean readLine(final CharArrayBuffer lineBuffer, final boolean endOfStream) throws IOException

Implements org.apache.hc.core5.http.nio.SessionInputBuffer.readLine.

Doc from org.apache.hc.core5.http.nio.SessionInputBuffer.readLine.

Attempts to transfer a complete line of characters up to a line delimiter from this buffer to the destination buffer. If a complete line is available in the buffer, the sequence of chars is transferred to the destination buffer the method returns true. The line delimiter itself is discarded. If a complete line is not available in the buffer, this method returns false without transferring anything to the destination buffer. If endOfStream parameter is set to true this method assumes the end of stream has been reached and the content currently stored in the buffer should be treated as a complete line.

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

Parameters
lineBuffer:CharArrayBuffer

the destination buffer.

endOfStream:boolean

end of stream flag

Returns:boolean

true if a sequence of chars representing a complete line has been transferred to the destination buffer, false otherwise.

Annotations
@Override