InputStream. This class buffers input data in
an internal byte array for optimal input performance.
readLine(CharArrayBuffer, InputStream) method 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 CharsetDecoder | |
| private final ByteArrayBuffer | |
| private final int | |
| private final BasicHttpTransportMetrics | |
| private final int |
| Access | Constructor and Description |
|---|---|
| public | SessionInputBufferImpl(final BasicHttpTransportMetrics
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 int maximum line length. maxLineLen, final CharsetDecoder 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 | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| public int | available()
Implements org. |
| public int | capacity()
Implements org. |
| public void | |
| public int | |
| public HttpTransportMetrics | getMetrics()
Implements org. HttpTransportMetrics for this session buffer.
|
| private int | |
| public boolean | |
| public int | length()
Implements org. |
| 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(final InputStream
Input stream inputStream)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, final InputStream Input stream inputStream)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, final InputStream Input stream inputStream)Implements org. b.
|
| public int | Returns: the total number of bytes read into the buffer, or-1 is there is no more data because the end of
the stream has been reached.the line buffer, one line of characters upon return charBuffer, final InputStream Input stream inputStream)Implements org. |
| 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 | |
| decoder | back to summary |
|---|---|
| private final CharsetDecoder decoder | |
| lineBuffer | back to summary |
|---|---|
| private final ByteArrayBuffer lineBuffer | |
| maxLineLen | back to summary |
|---|---|
| private final int maxLineLen | |
| metrics | back to summary |
|---|---|
| private final BasicHttpTransportMetrics metrics | |
| minChunkLimit | back to summary |
|---|---|
| private final int minChunkLimit | |
| SessionInputBufferImpl | back to summary |
|---|---|
| public SessionInputBufferImpl(final BasicHttpTransportMetrics metrics, final int bufferSize, final int minChunkLimit, final int maxLineLen, final CharsetDecoder charDecoder) Creates new instance of SessionInputBufferImpl.
| |
| SessionInputBufferImpl | back to summary |
|---|---|
| public SessionInputBufferImpl(final BasicHttpTransportMetrics metrics, final int bufferSize) | |
| SessionInputBufferImpl | back to summary |
|---|---|
| public SessionInputBufferImpl(final int bufferSize, final int maxLineLen) | |
| SessionInputBufferImpl | back to summary |
|---|---|
| public SessionInputBufferImpl(final int bufferSize, final CharsetDecoder decoder) | |
| SessionInputBufferImpl | back to summary |
|---|---|
| public SessionInputBufferImpl(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.
| |
| 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(final InputStream inputStream) 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) throws IOException | |
| hasBufferedData | back to summary |
|---|---|
| public boolean hasBufferedData() | |
| length | back to summary |
|---|---|
| public int length() Implements org. Doc from org. Returns 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(final InputStream inputStream) 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, final InputStream inputStream) 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, final InputStream inputStream) 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, final InputStream inputStream) 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.
| |