## org.apache.http.impl.io
Class SocketInputBuffer

    java.lang.Object
      org.apache.http.impl.io.AbstractSessionInputBuffer
          org.apache.http.impl.io.SocketInputBuffer

All Implemented Interfaces:
  BufferInfo, EofSensor, SessionInputBuffer

    @NotThreadSafe
    public class SocketInputBuffer

extends AbstractSessionInputBuffer
implements EofSensor

`SessionInputBuffer` implementation bound to a `Socket`.

The following parameters can be used to customize the behavior of this class:

- `CoreProtocolPNames.HTTP_ELEMENT_CHARSET`
- `CoreConnectionPNames.MAX_LINE_LENGTH`
- `CoreConnectionPNames.MIN_CHUNK_LIMIT`

Since:
  4.0

Constructor Summary
`SocketInputBuffer(Socket socket, int buffersize, HttpParams params)` Creates an instance of this class.

Method Summary
`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()`

Methods inherited from class org.apache.http.impl.io.AbstractSessionInputBuffer
`available, capacity, createTransportMetrics, getMetrics, hasBufferedData, init, length, read, read, read, readLine, readLine`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SocketInputBuffer

    public SocketInputBuffer(Socket socket,
                             int buffersize,
                             HttpParams params)
                      throws IOException

  Creates an instance of this class.

  Parameters:
    `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.
  Throws:
    `IOException`

Method Detail

### fillBuffer

    protected int fillBuffer()
                      throws IOException

  Overrides:
    `fillBuffer` in class `AbstractSessionInputBuffer`
  Throws:
    `IOException`

### isDataAvailable

    public boolean isDataAvailable(int timeout)
                            throws IOException

  Description copied from interface: `SessionInputBuffer`
  Blocks until some data becomes available in the session buffer or the given timeout period in milliseconds elapses. If the timeout value is `0` this method blocks indefinitely.

  Specified by:
    `isDataAvailable` in interface `SessionInputBuffer`
  Parameters:
    `timeout` - in milliseconds.
  Returns:
    `true` if some data is available in the session buffer or `false` otherwise.
  Throws:
    `IOException` - if an I/O error occurs.

### isEof

    public boolean isEof()

  Specified by:
    `isEof` in interface `EofSensor`

Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.