Home » HttpComponents-Core-4.0.1 » org.apache.http.io » [javadoc | source]
org.apache.http.io
public interface: SessionInputBuffer [javadoc | source]

All Known Implementing Classes:
    SocketInputBuffer, AbstractSessionInputBuffer

Session input buffer for blocking connections. This interface is similar to InputStream class, but it also provides methods for reading lines of text.

Implementing classes are also expected to manage intermediate data buffering for optimal input performance.

Method from org.apache.http.io.SessionInputBuffer Summary:
getMetrics,   isDataAvailable,   read,   read,   read,   readLine,   readLine
Method from org.apache.http.io.SessionInputBuffer Detail:
 public HttpTransportMetrics getMetrics()
 public boolean isDataAvailable(int timeout) throws IOException
    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.
 public int read() throws IOException
    Reads the next byte of data from this session buffer. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.
 public int read(byte[] b) throws IOException
    Reads some number of bytes from the session buffer and stores them into the buffer array b. 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.
 public int read(byte[] b,
    int off,
    int len) throws IOException
    Reads up to len bytes of data from the session buffer into an array of bytes. An attempt is made to read as many as len bytes, 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 off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

 public String readLine() throws IOException
    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, null is 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.

 public int readLine(CharArrayBuffer buffer) throws IOException
    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 -1 is 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.