org.apache.lucene.mockfile

## Class FilterInputStream2

- java.lang.Object
- - java.io.InputStream
  - - org.apache.lucene.mockfile.FilterInputStream2

- All Implemented Interfaces:
    Closeable, AutoCloseable

      public class FilterInputStream2
      extends InputStream

  A `FilterInputStream2` contains another `InputStream`, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality.

  Note: unlike `FilterInputStream` this class delegates every method by default. This means to transform `read` calls, you need to override multiple methods. On the other hand, it is less trappy: a simple implementation that just overrides `close` will not force bytes to be read one-at-a-time.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected InputStream` | `delegate` The underlying `InputStream` instance.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FilterInputStream2(InputStream delegate)` Construct a `FilterInputStream2` based on the specified base stream.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `available()`
    `void` | `close()`
    `void` | `mark(int readlimit)`
    `boolean` | `markSupported()`
    `int` | `read()`
    `int` | `read(byte[] b)`
    `int` | `read(byte[] b, int off, int len)`
    `void` | `reset()`
    `long` | `skip(long n)`

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

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

- - ### Field Detail

    - #### delegate

          protected final InputStream delegate

      The underlying `InputStream` instance.

  - ### Constructor Detail

    - #### FilterInputStream2

          public FilterInputStream2(InputStream delegate)

      Construct a `FilterInputStream2` based on the specified base stream.

      Note that base stream is closed if this stream is closed.

      Parameters:
        `delegate` - specified base stream.

  - ### Method Detail

    - #### read

          public int read()
                   throws IOException

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

    - #### read

          public int read(byte[] b)
                   throws IOException

      Overrides:
        `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`

    - #### skip

          public long skip(long n)
                    throws IOException

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

    - #### available

          public int available()
                        throws IOException

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

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `InputStream`
      Throws:
        `IOException`

    - #### mark

          public void mark(int readlimit)

      Overrides:
        `mark` in class `InputStream`

    - #### reset

          public void reset()
                     throws IOException

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

    - #### markSupported

          public boolean markSupported()

      Overrides:
        `markSupported` in class `InputStream`

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