@NotThreadSafe public class SessionInputBufferImpl extends java.lang.Object implements org.apache.http.io.SessionInputBuffer, BufferInfo
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.| Constructor and Description |
|---|
SessionInputBufferImpl(org.apache.http.impl.io.HttpTransportMetricsImpl metrics,
int buffersize) |
SessionInputBufferImpl(org.apache.http.impl.io.HttpTransportMetricsImpl metrics,
int buffersize,
int minChunkLimit,
MessageConstraints constraints,
java.nio.charset.CharsetDecoder chardecoder)
Creates new instance of SessionInputBufferImpl.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns available space in the buffer.
|
void |
bind(java.io.InputStream instream) |
int |
capacity()
Returns total capacity of the buffer
|
void |
clear() |
int |
fillBuffer() |
org.apache.http.io.HttpTransportMetrics |
getMetrics() |
boolean |
hasBufferedData() |
boolean |
isBound() |
boolean |
isDataAvailable(int timeout) |
int |
length()
Return length data stored in the buffer
|
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
java.lang.String |
readLine() |
int |
readLine(org.apache.http.util.CharArrayBuffer charbuffer)
Reads a complete line of characters up to a line delimiter from this
session buffer into the given line buffer.
|
public SessionInputBufferImpl(org.apache.http.impl.io.HttpTransportMetricsImpl metrics,
int buffersize,
int minChunkLimit,
MessageConstraints constraints,
java.nio.charset.CharsetDecoder chardecoder)
metrics - HTTP transport metrics.buffersize - buffer size. Must be a positive number.minChunkLimit - 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.constraints - Message constraints. If null
MessageConstraints.DEFAULT will be used.chardecoder - chardecoder to be used for decoding HTTP protocol elements.
If null simple type cast will be used for byte to char conversion.public SessionInputBufferImpl(org.apache.http.impl.io.HttpTransportMetricsImpl metrics,
int buffersize)
public void bind(java.io.InputStream instream)
public boolean isBound()
public int capacity()
BufferInfocapacity in interface BufferInfopublic int length()
BufferInfolength in interface BufferInfopublic int available()
BufferInfoavailable in interface BufferInfopublic int fillBuffer()
throws java.io.IOException
java.io.IOExceptionpublic boolean hasBufferedData()
public void clear()
public int read()
throws java.io.IOException
read in interface org.apache.http.io.SessionInputBufferjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in interface org.apache.http.io.SessionInputBufferjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read in interface org.apache.http.io.SessionInputBufferjava.io.IOExceptionpublic int readLine(org.apache.http.util.CharArrayBuffer charbuffer)
throws java.io.IOException
-1 is 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.
readLine in interface org.apache.http.io.SessionInputBuffercharbuffer - the line buffer.java.io.IOException - if an I/O error occurs.public java.lang.String readLine()
throws java.io.IOException
readLine in interface org.apache.http.io.SessionInputBufferjava.io.IOExceptionpublic boolean isDataAvailable(int timeout)
throws java.io.IOException
isDataAvailable in interface org.apache.http.io.SessionInputBufferjava.io.IOExceptionpublic org.apache.http.io.HttpTransportMetrics getMetrics()
getMetrics in interface org.apache.http.io.SessionInputBufferCopyright © 1999-2015 The Apache Software Foundation. All rights reserved.