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

## org.jboss.remoting.transport.coyote
Class InputBuffer

    java.lang.Object
      java.io.Reader
          org.jboss.remoting.transport.coyote.InputBuffer

All Implemented Interfaces:
  java.io.Closeable, java.lang.Readable, org.apache.tomcat.util.buf.ByteChunk.ByteInputChannel, org.apache.tomcat.util.buf.CharChunk.CharInputChannel, org.apache.tomcat.util.buf.CharChunk.CharOutputChannel

    public class InputBuffer

extends java.io.Reader
implements org.apache.tomcat.util.buf.ByteChunk.ByteInputChannel, org.apache.tomcat.util.buf.CharChunk.CharInputChannel, org.apache.tomcat.util.buf.CharChunk.CharOutputChannel

The buffer used by Tomcat request. This is a derivative of the Tomcat 3.3 OutputBuffer, adapted to handle input instead of output. This allows complete recycling of the facade objects (the ServletInputStream and the BufferedReader).

Author:
  Remy Maucherat

Field Summary
`int` | `BYTE_STATE`
`int` | `CHAR_STATE`
`protected org.apache.tomcat.util.buf.B2CConverter` | `conv` Current byte to char converter.
`static int` | `DEFAULT_BUFFER_SIZE`
`static java.lang.String` | `DEFAULT_ENCODING`
`protected java.util.HashMap` | `encoders` List of encoders.
`int` | `INITIAL_STATE`

Fields inherited from class java.io.Reader
`lock`

Constructor Summary
`InputBuffer()` Default constructor.
`InputBuffer(int size)` Alternate constructor which allows specifying the initial buffer size.

Method Summary
`int` | `available()`
`void` | `checkConverter()`
`void` | `close()` Close the input buffer.
`org.apache.coyote.Request` | `getRequest()` Get associated Coyote request.
`void` | `mark(int readAheadLimit)`
`boolean` | `markSupported()`
`int` | `read()`
`int` | `read(byte[] b, int off, int len)`
`int` | `read(char[] cbuf)`
`int` | `read(char[] cbuf, int off, int len)`
`int` | `readByte()`
`boolean` | `ready()`
`int` | `realReadBytes(byte[] cbuf, int off, int len)` Reads new bytes in the byte chunk.
`int` | `realReadChars(char[] cbuf, int off, int len)`
`void` | `realWriteChars(char[] c, int off, int len)` Since the converter will use append, it is possible to get chars to be removed from the buffer for "writing".
`void` | `recycle()` Recycle the output buffer.
`void` | `reset()`
`protected void` | `setConverter()`
`void` | `setEncoding(java.lang.String s)`
`void` | `setRequest(org.apache.coyote.Request coyoteRequest)` Associated Coyote request.
`long` | `skip(long n)`

Methods inherited from class java.io.Reader
`read`

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

Field Detail

### DEFAULT_ENCODING

    public static final java.lang.String DEFAULT_ENCODING

See Also:
  Constant Field Values

### DEFAULT_BUFFER_SIZE

    public static final int DEFAULT_BUFFER_SIZE

See Also:
  Constant Field Values

### INITIAL_STATE

    public final int INITIAL_STATE

See Also:
  Constant Field Values

### CHAR_STATE

    public final int CHAR_STATE

See Also:
  Constant Field Values

### BYTE_STATE

    public final int BYTE_STATE

See Also:
  Constant Field Values

### encoders

    protected java.util.HashMap encoders

  List of encoders.

### conv

    protected org.apache.tomcat.util.buf.B2CConverter conv

  Current byte to char converter.

Constructor Detail

### InputBuffer

    public InputBuffer()

  Default constructor. Allocate the buffer with the default buffer size.

### InputBuffer

    public InputBuffer(int size)

  Alternate constructor which allows specifying the initial buffer size.

  Parameters:
    `size` - Buffer size to use

Method Detail

### setRequest

    public void setRequest(org.apache.coyote.Request coyoteRequest)

  Associated Coyote request.

  Parameters:
    `coyoteRequest` - Associated Coyote request

### getRequest

    public org.apache.coyote.Request getRequest()

  Get associated Coyote request.

  Returns:
    the associated Coyote request

### recycle

    public void recycle()

  Recycle the output buffer.

### close

    public void close()
               throws java.io.IOException

  Close the input buffer.

  Specified by:
    `close` in interface `java.io.Closeable`
  Specified by:
    `close` in class `java.io.Reader`
  Throws:
    `java.io.IOException` - An underlying IOException occurred

### available

    public int available()
                  throws java.io.IOException

  Throws:
    `java.io.IOException`

### realReadBytes

    public int realReadBytes(byte[] cbuf,
                             int off,
                             int len)
                      throws java.io.IOException

  Reads new bytes in the byte chunk.

  Specified by:
    `realReadBytes` in interface `org.apache.tomcat.util.buf.ByteChunk.ByteInputChannel`
  Parameters:
    `cbuf` - Byte buffer to be written to the response
    `off` - Offset
    `len` - Length
  Throws:
    `java.io.IOException` - An underlying IOException occurred

### readByte

    public int readByte()
                 throws java.io.IOException

  Throws:
    `java.io.IOException`

### read

    public int read(byte[] b,
                    int off,
                    int len)
             throws java.io.IOException

  Throws:
    `java.io.IOException`

### realWriteChars

    public void realWriteChars(char[] c,
                               int off,
                               int len)
                        throws java.io.IOException

  Since the converter will use append, it is possible to get chars to be removed from the buffer for "writing". Since the chars have already been read before, they are ignored. If a mark was set, then the mark is lost.

  Specified by:
    `realWriteChars` in interface `org.apache.tomcat.util.buf.CharChunk.CharOutputChannel`
  Throws:
    `java.io.IOException`

### setEncoding

    public void setEncoding(java.lang.String s)

### realReadChars

    public int realReadChars(char[] cbuf,
                             int off,
                             int len)
                      throws java.io.IOException

  Specified by:
    `realReadChars` in interface `org.apache.tomcat.util.buf.CharChunk.CharInputChannel`
  Throws:
    `java.io.IOException`

### read

    public int read()
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

### read

    public int read(char[] cbuf)
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

### read

    public int read(char[] cbuf,
                    int off,
                    int len)
             throws java.io.IOException

  Specified by:
    `read` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

### skip

    public long skip(long n)
              throws java.io.IOException

  Overrides:
    `skip` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

### ready

    public boolean ready()
                  throws java.io.IOException

  Overrides:
    `ready` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

### markSupported

    public boolean markSupported()

  Overrides:
    `markSupported` in class `java.io.Reader`

### mark

    public void mark(int readAheadLimit)
              throws java.io.IOException

  Overrides:
    `mark` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

### reset

    public void reset()
               throws java.io.IOException

  Overrides:
    `reset` in class `java.io.Reader`
  Throws:
    `java.io.IOException`

### checkConverter

    public void checkConverter()
                        throws java.io.IOException

  Throws:
    `java.io.IOException`

### setConverter

    protected void setConverter()
                         throws java.io.IOException

  Throws:
    `java.io.IOException`

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

Copyright ? 1998-2005 JBoss Inc . All Rights Reserved.