InputStream. This class buffers input data in
an internal byte array for optimal input performance.
readLine(CharArrayBuffer) and readLine() methods of this
class treat a lone LF as valid line delimiters in addition to CR-LF required
by the HTTP specification.
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | |
| private int | |
| private int | |
| private CharBuffer | |
| private final MessageConstraints | |
| private final CharsetDecoder | |
| private InputStream | |
| private final ByteArrayBuffer | |
| private final HttpTransportMetricsImpl | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public | SessionInputBufferImpl(final HttpTransportMetricsImpl
HTTP transport metrics. metrics, final int buffer size. Must be a positive number. bufferSize, final int size limit below which data chunks should be buffered in memory
in order to minimize native method invocations on the underlying network socket.
The optimal value of this parameter can be platform specific and defines a trade-off
between performance of memory copy operations and that of native method invocation.
If negative default chunk limited will be used. minChunkLimit, final MessageConstraints Message constraints. If constraints, final CharsetDecoder null
MessageConstraints#DEFAULT will be used.CharDecoder to be used for decoding HTTP protocol elements.
If charDecoder)null simple type cast will be used for byte to char conversion.Creates new instance of SessionInputBufferImpl. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| public int | available()
Implements org. |
| public void | |
| public int | |
| public void | |
| public int | |
| public HttpTransportMetrics | getMetrics()
Implements org. HttpTransportMetrics for this session buffer.
|
| private int | handleDecodingResult(final CoderResult result, final CharArrayBuffer charbuffer, final ByteBuffer bbuf)
|
| public boolean | |
| public boolean | |
| public boolean | isDataAvailable(final int
in milliseconds. timeout)Implements org. |
| public int | |
| private int | Returns: HTTP line as a stringReads a complete line of characters up to a line delimiter from this session buffer. |
| private int | |
| public int | read()
Implements org. |
| public int | read(final byte[]
the buffer into which the data is read. b, final int the start offset in array off, final int b
at which the data is written.the maximum number of bytes to read. len)Implements org. len bytes of data from the session buffer into
an array of bytes.
|
| public int | read(final byte[]
the buffer into which the data is read. b)Implements org. b.
|
| public int | Returns: one line of charactersthe line buffer. charbuffer)Implements org. |
| public String | readLine()
Implements org. |
| private int |
| buffer | back to summary |
|---|---|
| private final byte[] buffer | |
| bufferLen | back to summary |
|---|---|
| private int bufferLen | |
| bufferPos | back to summary |
|---|---|
| private int bufferPos | |
| cbuf | back to summary |
|---|---|
| private CharBuffer cbuf | |
| constraints | back to summary |
|---|---|
| private final MessageConstraints constraints | |
| decoder | back to summary |
|---|---|
| private final CharsetDecoder decoder | |
| inStream | back to summary |
|---|---|
| private InputStream inStream | |
| lineBuffer | back to summary |
|---|---|
| private final ByteArrayBuffer lineBuffer | |
| metrics | back to summary |
|---|---|
| private final HttpTransportMetricsImpl metrics | |
| minChunkLimit | back to summary |
|---|---|
| private final int minChunkLimit | |
| SessionInputBufferImpl | back to summary |
|---|---|
| public SessionInputBufferImpl(final HttpTransportMetricsImpl metrics, final int bufferSize, final int minChunkLimit, final MessageConstraints constraints, final CharsetDecoder charDecoder) Creates new instance of SessionInputBufferImpl.
| |
| SessionInputBufferImpl | back to summary |
|---|---|
| public SessionInputBufferImpl(final HttpTransportMetricsImpl metrics, final int bufferSize) | |
| appendDecoded | back to summary |
|---|---|
| private int appendDecoded(final CharArrayBuffer charbuffer, final ByteBuffer bbuf) throws IOException | |
| available | back to summary |
|---|---|
| public int available() Implements org. Doc from org. Returns available space in the buffer.
| |
| bind | back to summary |
|---|---|
| public void bind(final InputStream inputStream) | |
| capacity | back to summary |
|---|---|
| public int capacity() Implements org. Doc from org. Returns total capacity of the buffer
| |
| clear | back to summary |
|---|---|
| public void clear() | |
| fillBuffer | back to summary |
|---|---|
| public int fillBuffer() throws IOException | |
| getMetrics | back to summary |
|---|---|
| public HttpTransportMetrics getMetrics() Implements org. Doc from org. Returns
| |
| handleDecodingResult | back to summary |
|---|---|
| private int handleDecodingResult(final CoderResult result, final CharArrayBuffer charbuffer, final ByteBuffer bbuf) throws IOException | |
| hasBufferedData | back to summary |
|---|---|
| public boolean hasBufferedData() | |
| isBound | back to summary |
|---|---|
| public boolean isBound() | |
| isDataAvailable | back to summary |
|---|---|
| public boolean isDataAvailable(final int timeout) throws IOException Implements org. Doc from org. Blocks until some data becomes available in the session buffer or the
given timeout period in milliseconds elapses. If the timeout value is
| |
| length | back to summary |
|---|---|
| public int length() Implements org. Doc from org. Return length data stored in the buffer
| |
| lineFromLineBuffer | back to summary |
|---|---|
| private int lineFromLineBuffer(final CharArrayBuffer charbuffer) throws IOException Reads a complete line of characters up to a line delimiter from this
session buffer. The line delimiter itself is discarded. If no char is
available because the end of the stream has been reached,
This method treats a lone LF as a valid line delimiters in addition to CR-LF required by the HTTP specification.
| |
| lineFromReadBuffer | back to summary |
|---|---|
| private int lineFromReadBuffer(final CharArrayBuffer charbuffer, final int position) throws IOException | |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements org. Doc from org. Reads the next byte of data from this session buffer. The value byte is
returned as an
| |
| read | back to summary |
|---|---|
| public int read(final byte[] b, final int off, final int len) throws IOException Implements org. Doc from org. Reads up to This method blocks until input data is available, end of file is detected, or an exception is thrown. If
| |
| read | back to summary |
|---|---|
| public int read(final byte[] b) throws IOException Implements org. Doc from org. Reads some number of bytes from the session buffer and stores them into
the buffer array
| |
| readLine | back to summary |
|---|---|
| public int readLine(final CharArrayBuffer charbuffer) throws IOException Implements org. Reads a complete line of characters up to a line delimiter from this
session buffer into the given line buffer. The number of chars actually
read is returned as an integer. The line delimiter itself is discarded.
If no char is available because the end of the stream has been reached,
the value This method treats a lone LF as a valid line delimiters in addition to CR-LF required by the HTTP specification.
| |
| readLine | back to summary |
|---|---|
| public String readLine() throws IOException Implements org. Doc from org. Reads a complete line of characters up to a line delimiter from this
session buffer. The line delimiter itself is discarded. If no char is
available because the end of the stream has been reached,
The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.
| |
| streamRead | back to summary |
|---|---|
| private int streamRead(final byte[] b, final int off, final int len) throws IOException | |