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

## rabbit.io
Class MaxSizeInputStream

    java.lang.Object
      java.io.InputStream
          rabbit.io.MaxSizeInputStream

All Implemented Interfaces:
  java.io.Closeable

    public class MaxSizeInputStream

extends java.io.InputStream

This class allows setting the size of the inputstream to a maximum nuber of bytes.

Constructor Summary
`MaxSizeInputStream(java.io.InputStream is, long l)` Creates a new MaxSizeInputStream with a given limit on the given stream.

Method Summary
`int` | `available()` Get the number of bytes ready for reading.
`int` | `read()` Reads the next byte of data from this input stream.
`int` | `read(byte[] b)` Read a block of data (up to b.length bytes).
`int` | `read(byte[] b, int off, int len)` Read a block of data (up to len bytes).
`long` | `skip(long n)` Skip a number of bytes.

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

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

Constructor Detail

### MaxSizeInputStream

    public MaxSizeInputStream(java.io.InputStream is,
                              long l)

  Creates a new MaxSizeInputStream with a given limit on the given stream.

Method Detail

### available

    public int available()
                  throws java.io.IOException

  Get the number of bytes ready for reading.

  Overrides:
    `available` in class `java.io.InputStream`
  Returns:
    the number of bytes that can be read without blocking.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### read

    public int read()
             throws java.io.IOException

  Reads the next byte of data from this input stream. 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.

  Specified by:
    `read` in class `java.io.InputStream`
  Returns:
    the next byte of data, or -1 if the end of the stream is reached.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### read

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

  Read a block of data (up to b.length bytes).

  Overrides:
    `read` in class `java.io.InputStream`
  Returns:
    the number of byte actually read.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### read

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

  Read a block of data (up to len bytes).

  Overrides:
    `read` in class `java.io.InputStream`
  Returns:
    the number of byte actually read.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### skip

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

  Skip a number of bytes.

  Overrides:
    `skip` in class `java.io.InputStream`
  Returns:
    the number of byte actually skipped.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

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