org.jboss.netty.buffer

## Class ChannelBufferInputStream

- java.lang.Object
- - java.io.InputStream
  - - org.jboss.netty.buffer.ChannelBufferInputStream

All Implemented Interfaces:
  Closeable, DataInput, AutoCloseable

    public class ChannelBufferInputStream
    extends InputStream
    implements DataInput

An `InputStream` which reads data from a `ChannelBuffer`.

A read operation against this stream will occur at the `readerIndex` of its underlying buffer and the `readerIndex` will increase during the read operation.

This stream implements `DataInput` for your convenience. The endianness of the stream is not always big endian but depends on the endianness of the underlying buffer.

See Also:
  `ChannelBufferOutputStream`

### Constructor Summary

Constructors
Constructor and Description
`ChannelBufferInputStream(ChannelBuffer buffer)` Creates a new stream which reads data from the specified `buffer` starting at the current `readerIndex` and ending at the current `writerIndex`.
`ChannelBufferInputStream(ChannelBuffer buffer, int length)` Creates a new stream which reads data from the specified `buffer` starting at the current `readerIndex` and ending at `readerIndex + length`.

### Method Summary

Methods
`int` `available()`
`void` `mark(int readlimit)`
`boolean` `markSupported()`
`int` `read()`
`int` `read(byte[] b, int off, int len)`
`boolean` `readBoolean()`
`byte` `readByte()`
`int` `readBytes()` Returns the number of read bytes by this stream so far.
`char` `readChar()`
`double` `readDouble()`
`float` `readFloat()`
`void` `readFully(byte[] b)`
`void` `readFully(byte[] b, int off, int len)`
`int` `readInt()`
`String` `readLine()`
`long` `readLong()`
`short` `readShort()`
`int` `readUnsignedByte()`
`int` `readUnsignedShort()`
`String` `readUTF()`
`void` `reset()`
`long` `skip(long n)`
`int` `skipBytes(int n)`

### Methods inherited from class java.io.InputStream

`close, read`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ChannelBufferInputStream

    public ChannelBufferInputStream(ChannelBuffer buffer)

Creates a new stream which reads data from the specified `buffer` starting at the current `readerIndex` and ending at the current `writerIndex`.

#### ChannelBufferInputStream

    public ChannelBufferInputStream(ChannelBuffer buffer,
                            int length)

Creates a new stream which reads data from the specified `buffer` starting at the current `readerIndex` and ending at `readerIndex + length`.

Throws:
  `IndexOutOfBoundsException` - if `readerIndex + length` is greater than `writerIndex`

### Method Detail

#### readBytes

    public int readBytes()

Returns the number of read bytes by this stream so far.

#### available

    public int available()
                  throws IOException

Overrides:
  `available` in class `InputStream`
Throws:
  `IOException`

#### mark

    public void mark(int readlimit)

Overrides:
  `mark` in class `InputStream`

#### markSupported

    public boolean markSupported()

Overrides:
  `markSupported` in class `InputStream`

#### read

    public int read()
             throws IOException

Specified by:
  `read` in class `InputStream`
Throws:
  `IOException`

#### read

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

Overrides:
  `read` in class `InputStream`
Throws:
  `IOException`

#### reset

    public void reset()
               throws IOException

Overrides:
  `reset` in class `InputStream`
Throws:
  `IOException`

#### skip

    public long skip(long n)
              throws IOException

Overrides:
  `skip` in class `InputStream`
Throws:
  `IOException`

#### readBoolean

    public boolean readBoolean()
                        throws IOException

Specified by:
  `readBoolean` in interface `DataInput`
Throws:
  `IOException`

#### readByte

    public byte readByte()
                  throws IOException

Specified by:
  `readByte` in interface `DataInput`
Throws:
  `IOException`

#### readChar

    public char readChar()
                  throws IOException

Specified by:
  `readChar` in interface `DataInput`
Throws:
  `IOException`

#### readDouble

    public double readDouble()
                      throws IOException

Specified by:
  `readDouble` in interface `DataInput`
Throws:
  `IOException`

#### readFloat

    public float readFloat()
                    throws IOException

Specified by:
  `readFloat` in interface `DataInput`
Throws:
  `IOException`

#### readFully

    public void readFully(byte[] b)
                   throws IOException

Specified by:
  `readFully` in interface `DataInput`
Throws:
  `IOException`

#### readFully

    public void readFully(byte[] b,
                 int off,
                 int len)
                   throws IOException

Specified by:
  `readFully` in interface `DataInput`
Throws:
  `IOException`

#### readInt

    public int readInt()
                throws IOException

Specified by:
  `readInt` in interface `DataInput`
Throws:
  `IOException`

#### readLine

    public String readLine()
                    throws IOException

Specified by:
  `readLine` in interface `DataInput`
Throws:
  `IOException`

#### readLong

    public long readLong()
                  throws IOException

Specified by:
  `readLong` in interface `DataInput`
Throws:
  `IOException`

#### readShort

    public short readShort()
                    throws IOException

Specified by:
  `readShort` in interface `DataInput`
Throws:
  `IOException`

#### readUTF

    public String readUTF()
                   throws IOException

Specified by:
  `readUTF` in interface `DataInput`
Throws:
  `IOException`

#### readUnsignedByte

    public int readUnsignedByte()
                         throws IOException

Specified by:
  `readUnsignedByte` in interface `DataInput`
Throws:
  `IOException`

#### readUnsignedShort

    public int readUnsignedShort()
                          throws IOException

Specified by:
  `readUnsignedShort` in interface `DataInput`
Throws:
  `IOException`

#### skipBytes

    public int skipBytes(int n)
                  throws IOException

Specified by:
  `skipBytes` in interface `DataInput`
Throws:
  `IOException`