Class AbstractSessionInputBuffer
- All Implemented Interfaces:
BufferInfo,SessionInputBuffer
- Direct Known Subclasses:
SocketInputBuffer
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.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanDeprecated.private byte[]Deprecated.private intDeprecated.private intDeprecated.private CharBufferDeprecated.private CharsetDeprecated.private CharsetDecoderDeprecated.private InputStreamDeprecated.private ByteArrayBufferDeprecated.private intDeprecated.private HttpTransportMetricsImplDeprecated.private intDeprecated.private CodingErrorActionDeprecated.private CodingErrorActionDeprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate intappendDecoded(CharArrayBuffer charbuffer, ByteBuffer bbuf) Deprecated.intDeprecated.Returns available space in the buffer.intcapacity()Deprecated.Returns total capacity of the bufferprotected HttpTransportMetricsImplDeprecated.protected intDeprecated.Deprecated.ReturnsHttpTransportMetricsfor this session buffer.private inthandleDecodingResult(CoderResult result, CharArrayBuffer charbuffer, ByteBuffer bbuf) Deprecated.protected booleanDeprecated.protected voidinit(InputStream inputStream, int bufferSize, HttpParams params) Deprecated.Initializes this session input buffer.intlength()Deprecated.Return length data stored in the bufferprivate intlineFromLineBuffer(CharArrayBuffer charbuffer) Deprecated.Reads a complete line of characters up to a line delimiter from this session buffer.private intlineFromReadBuffer(CharArrayBuffer charbuffer, int position) Deprecated.private intlocateLF()Deprecated.intread()Deprecated.Reads the next byte of data from this session buffer.intread(byte[] b) Deprecated.Reads some number of bytes from the session buffer and stores them into the buffer arrayb.intread(byte[] b, int off, int len) Deprecated.Reads up tolenbytes of data from the session buffer into an array of bytes.readLine()Deprecated.Reads a complete line of characters up to a line delimiter from this session buffer.intreadLine(CharArrayBuffer charbuffer) Deprecated.Reads a complete line of characters up to a line delimiter from this session buffer into the given line buffer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.http.io.SessionInputBuffer
isDataAvailable
-
Field Details
-
inStream
Deprecated. -
buffer
private byte[] bufferDeprecated. -
lineBuffer
Deprecated. -
charset
Deprecated. -
ascii
private boolean asciiDeprecated. -
maxLineLen
private int maxLineLenDeprecated. -
minChunkLimit
private int minChunkLimitDeprecated. -
metrics
Deprecated. -
onMalformedCharAction
Deprecated. -
onUnmappableCharAction
Deprecated. -
bufferPos
private int bufferPosDeprecated. -
bufferLen
private int bufferLenDeprecated. -
decoder
Deprecated. -
cbuf
Deprecated.
-
-
Constructor Details
-
AbstractSessionInputBuffer
public AbstractSessionInputBuffer()Deprecated.
-
-
Method Details
-
init
Deprecated.Initializes this session input buffer.- Parameters:
inputStream- the source input stream.bufferSize- the size of the internal buffer.params- HTTP parameters.
-
createTransportMetrics
Deprecated.- Since:
- 4.1
-
capacity
public int capacity()Deprecated.Description copied from interface:BufferInfoReturns total capacity of the buffer- Specified by:
capacityin interfaceBufferInfo- Returns:
- total capacity
- Since:
- 4.1
-
length
public int length()Deprecated.Description copied from interface:BufferInfoReturn length data stored in the buffer- Specified by:
lengthin interfaceBufferInfo- Returns:
- data length
- Since:
- 4.1
-
available
public int available()Deprecated.Description copied from interface:BufferInfoReturns available space in the buffer.- Specified by:
availablein interfaceBufferInfo- Returns:
- available space.
- Since:
- 4.1
-
fillBuffer
Deprecated.- Throws:
IOException
-
hasBufferedData
protected boolean hasBufferedData()Deprecated. -
read
Deprecated.Description copied from interface:SessionInputBufferReads the next byte of data from this session buffer. The value byte is returned as anintin the range0to255. If no byte is available because the end of the stream has been reached, the value-1is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.- Specified by:
readin interfaceSessionInputBuffer- Returns:
- the next byte of data, or
-1if the end of the stream is reached. - Throws:
IOException- if an I/O error occurs.
-
read
Deprecated.Description copied from interface:SessionInputBufferReads up tolenbytes of data from the session buffer into an array of bytes. An attempt is made to read as many aslenbytes, but a smaller number may be read, possibly zero. The number of bytes actually read is returned as an integer.This method blocks until input data is available, end of file is detected, or an exception is thrown.
If
offis negative, orlenis negative, oroff+lenis greater than the length of the arrayb, then anIndexOutOfBoundsExceptionis thrown.- Specified by:
readin interfaceSessionInputBuffer- Parameters:
b- the buffer into which the data is read.off- the start offset in arraybat which the data is written.len- the maximum number of bytes to read.- Returns:
- the total number of bytes read into the buffer, or
-1if there is no more data because the end of the stream has been reached. - Throws:
IOException- if an I/O error occurs.
-
read
Deprecated.Description copied from interface:SessionInputBufferReads some number of bytes from the session buffer and stores them into the buffer arrayb. The number of bytes actually read is returned as an integer. This method blocks until input data is available, end of file is detected, or an exception is thrown.- Specified by:
readin interfaceSessionInputBuffer- Parameters:
b- the buffer into which the data is read.- Returns:
- the total number of bytes read into the buffer, or
-1is there is no more data because the end of the stream has been reached. - Throws:
IOException- if an I/O error occurs.
-
locateLF
private int locateLF()Deprecated. -
readLine
Deprecated.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-1is returned. This method blocks until input data is available, end of file is detected, or an exception is thrown.This method treats a lone LF as a valid line delimiters in addition to CR-LF required by the HTTP specification.
- Specified by:
readLinein interfaceSessionInputBuffer- Parameters:
charbuffer- the line buffer.- Returns:
- one line of characters
- Throws:
IOException- if an I/O error occurs.
-
lineFromLineBuffer
Deprecated.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,nullis returned. This method blocks until input data is available, end of file is detected, or an exception is thrown.This method treats a lone LF as a valid line delimiters in addition to CR-LF required by the HTTP specification.
- Returns:
- HTTP line as a string
- Throws:
IOException- if an I/O error occurs.
-
lineFromReadBuffer
Deprecated.- Throws:
IOException
-
appendDecoded
Deprecated.- Throws:
IOException
-
handleDecodingResult
private int handleDecodingResult(CoderResult result, CharArrayBuffer charbuffer, ByteBuffer bbuf) throws IOException Deprecated.- Throws:
IOException
-
readLine
Deprecated.Description copied from interface:SessionInputBufferReads 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,nullis returned. This method blocks until input data is available, end of file is detected, or an exception is thrown.The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.
- Specified by:
readLinein interfaceSessionInputBuffer- Returns:
- HTTP line as a string
- Throws:
IOException- if an I/O error occurs.
-
getMetrics
Deprecated.Description copied from interface:SessionInputBufferReturnsHttpTransportMetricsfor this session buffer.- Specified by:
getMetricsin interfaceSessionInputBuffer- Returns:
- transport metrics.
-
SessionInputBufferImpl