|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.http.impl.io.SessionInputBufferImpl
@NotThreadSafe public class SessionInputBufferImpl
Abstract base class for session input buffers that stream data from
an arbitrary 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 Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
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)
| Method Detail |
|---|
public void bind(java.io.InputStream instream)
public boolean isBound()
public int capacity()
BufferInfo
capacity in interface BufferInfopublic int length()
BufferInfo
length in interface BufferInfopublic int available()
BufferInfo
available in interface BufferInfo
public 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.IOException
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in interface org.apache.http.io.SessionInputBufferjava.io.IOException
public int read(byte[] b)
throws java.io.IOException
read in interface org.apache.http.io.SessionInputBufferjava.io.IOException
public 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.IOException
public 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.SessionInputBuffer
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||