Package fr.gouv.vitam.common.junit

# Class FakeInputStream

java.lang.Object
java.io.InputStream
fr.gouv.vitam.common.junit.FakeInputStream

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class FakeInputStream extends InputStream
Fake InputStream: test class only

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FakeInputStream(long limit)`
  Constructor of Fake InputStream
  Preferred constructor
  `FakeInputStream(long limit, boolean block)`
  Constructor of Fake InputStream
  `FakeInputStream(long limit, boolean block, boolean useRandom)`
  Constructor of Fake InputStream

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `available()`
  `void`
  `close()`
  `int`
  `read()`
  `int`
  `read(byte[] b)`
  `int`
  `read(byte[] b, int off, int len)`
  `long`
  `readCount()`

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

  `mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo`

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

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

- ## Constructor Details

  - ### FakeInputStream

    public FakeInputStream(long limit)
    Constructor of Fake InputStream
    Preferred constructor
    Parameters:
      `limit` - the total size of the InputStream

  - ### FakeInputStream

    public FakeInputStream(long limit, boolean block)
    Constructor of Fake InputStream
    Parameters:
      `limit` - the total size of the InputStream
      `block` - True means the byte are read per block and False means one by one read

  - ### FakeInputStream

    public FakeInputStream(long limit, boolean block, boolean useRandom)
    Constructor of Fake InputStream
    Parameters:
      `limit` - the total size of the InputStream
      `block` - True means the byte are read per block and False means one by one read
      `useRandom` - True use random values for each bytes, else 42 for each

- ## Method Details

  - ### read

    public int read()
    Specified by:
      `read` in class `InputStream`

  - ### available

    public int available()
    Overrides:
      `available` in class `InputStream`

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Overrides:
      `close` in class `InputStream`

  - ### read

    public int read(byte[] b, int off, int len)
    Overrides:
      `read` in class `InputStream`

  - ### read

    public int read(byte[] b)
    Overrides:
      `read` in class `InputStream`

  - ### readCount

    public long readCount()
    Returns:
      the number of truely read bytes