public class SocketInputBuffer extends AbstractSessionInputBuffer implements EofSensor
SessionInputBuffer
implementation bound to a Socket
.Constructor and Description |
---|
SocketInputBuffer(java.net.Socket socket,
int buffersize,
HttpParams params)
Creates an instance of this class.
|
Modifier and Type | Method and Description |
---|---|
protected int |
fillBuffer() |
boolean |
isDataAvailable(int timeout)
Blocks until some data becomes available in the session buffer or the
given timeout period in milliseconds elapses.
|
boolean |
isEof() |
getMetrics, hasBufferedData, init, read, read, read, readLine, readLine
public SocketInputBuffer(java.net.Socket socket, int buffersize, HttpParams params) throws java.io.IOException
The following HTTP parameters affect the initialization:
The CoreProtocolPNames.HTTP_ELEMENT_CHARSET
parameter determines the charset to be used for decoding HTTP lines. If
not specified, US-ASCII
will be used per default.
The CoreConnectionPNames.MAX_LINE_LENGTH
parameter determines
the maximum line length limit. If set to a positive value, any HTTP
line exceeding this limit will cause an IOException. A negative or zero
value will effectively disable the check. Per default the line length
check is disabled.
socket
- the socket to read data from.buffersize
- the size of the internal buffer. If this number is less
than 0
it is set to the value of
Socket.getReceiveBufferSize()
. If resultant number is less
than 1024
it is set to 1024
.params
- HTTP parameters.java.io.IOException
CoreProtocolPNames.HTTP_ELEMENT_CHARSET
,
CoreConnectionPNames.MAX_LINE_LENGTH
protected int fillBuffer() throws java.io.IOException
fillBuffer
in class AbstractSessionInputBuffer
java.io.IOException
public boolean isDataAvailable(int timeout) throws java.io.IOException
SessionInputBuffer
0
this method blocks indefinitely.isDataAvailable
in interface SessionInputBuffer
timeout
- in milliseconds.true
if some data is available in the session
buffer or false
otherwise.java.io.IOException
- if an I/O error occurs.