Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.connector.http
Class SocketInputStream

    java.lang.Object
      |
      +--java.io.InputStream
            |
            +--org.apache.catalina.connector.http.SocketInputStream

public class SocketInputStream
extends java.io.InputStream

Extends InputStream to be more efficient reading lines during HTTP header processing.

Author:
  Remy Maucherat

Field Summary
`protected byte[]` | `buf` Internal buffer.
`protected int` | `count` Last valid byte.
`protected java.io.InputStream` | `is` Underlying input stream.
`protected int` | `pos` Position in the buffer.
`protected static StringManager` | `sm` The string manager for this package.

Constructor Summary
`SocketInputStream(java.io.InputStream is, int bufferSize)` Construct a servlet input stream associated with the specified socket input.

Method Summary
`int` | `available()` Returns the number of bytes that can be read from this input stream without blocking.
`void` | `close()` Close the input stream.
`protected void` | `fill()` Fill the internal buffer using data from the undelying input stream.
`int` | `read()` Read byte.
`void` | `readHeader(org.apache.catalina.connector.http.HttpHeader header)` Read a header, and copies it to the given buffer.
`void` | `readRequestLine(org.apache.catalina.connector.http.HttpRequestLine requestLine)` Read the request line, and copies it to the given buffer.

Methods inherited from class java.io.InputStream
`mark, markSupported, read, read, reset, skip`

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

Field Detail

### buf

    protected byte[] buf

  Internal buffer.

### count

    protected int count

  Last valid byte.

### pos

    protected int pos

  Position in the buffer.

### is

    protected java.io.InputStream is

  Underlying input stream.

### sm

    protected static StringManager sm

  The string manager for this package.

Constructor Detail

### SocketInputStream

    public SocketInputStream(java.io.InputStream is,
                             int bufferSize)

  Construct a servlet input stream associated with the specified socket input.
  Parameters:
    `is` - socket input stream
    `bufferSize` - size of the internal buffer

Method Detail

### readRequestLine

    public void readRequestLine(org.apache.catalina.connector.http.HttpRequestLine requestLine)
                         throws java.io.IOException

  Read the request line, and copies it to the given buffer. This function is meant to be used during the HTTP request header parsing. Do NOT attempt to read the request body using it.
  Parameters:
    `requestLine` - Request line object
  Throws:
    `java.io.IOException` - If an exception occurs during the underlying socket read operations, or if the given buffer is not big enough to accomodate the whole line.

### readHeader

    public void readHeader(org.apache.catalina.connector.http.HttpHeader header)
                    throws java.io.IOException

  Read a header, and copies it to the given buffer. This function is meant to be used during the HTTP request header parsing. Do NOT attempt to read the request body using it.
  Parameters:
    `requestLine` - Request line object
  Throws:
    `java.io.IOException` - If an exception occurs during the underlying socket read operations, or if the given buffer is not big enough to accomodate the whole line.

### read

    public int read()
             throws java.io.IOException

  Read byte.
  Overrides:
    `read` in class `java.io.InputStream`

### available

    public int available()
                  throws java.io.IOException

  Returns the number of bytes that can be read from this input stream without blocking.
  Overrides:
    `available` in class `java.io.InputStream`

### close

    public void close()
               throws java.io.IOException

  Close the input stream.
  Overrides:
    `close` in class `java.io.InputStream`

### fill

    protected void fill()
                 throws java.io.IOException

  Fill the internal buffer using data from the undelying input stream.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2001 Apache Software Foundation. All Rights Reserved.