Package fr.gouv.vitam.common.stream

# Class MultiplePipedInputStream

java.lang.Object
fr.gouv.vitam.common.stream.MultiplePipedInputStream

All Implemented Interfaces:
  `VitamAutoCloseable`, `AutoCloseable`

public class MultiplePipedInputStream extends Object implements VitamAutoCloseable
Generate multiples InputStreams from one to many using Pipe

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MultiplePipedInputStream(InputStream source, int nbCopy)`
  Create one MultipleInputStreamHandler from one InputStream and make nbCopy linked InputStreams

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `protected final void`
  `copy()`
  `InputStream`
  `getInputStream(int rank)`
  Get the rank-th linked InputStream
  `void`
  `throwLastException()`

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

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

- ## Constructor Details

  - ### MultiplePipedInputStream

    public MultiplePipedInputStream(InputStream source, int nbCopy)
    Create one MultipleInputStreamHandler from one InputStream and make nbCopy linked InputStreams
    Parameters:
      `source` -
      `nbCopy` -
    Throws:
      `IllegalArgumentException` - if source is null or nbCopy <= 0 or global service is down

- ## Method Details

  - ### getInputStream

    public InputStream getInputStream(int rank)
    Get the rank-th linked InputStream
    Parameters:
      `rank` - between 0 and nbCopy-1
    Returns:
      the rank-th linked InputStream
    Throws:
      `IllegalArgumentException` - if rank < 0 or rank >= nbCopy

  - ### throwLastException

    public void throwLastException() throws IOException
    Throws:
      `IOException` - if any exception is found during multiple streams

  - ### copy

    protected final void copy() throws IOException
    Throws:
      `IOException`

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `VitamAutoCloseable`