Package fr.gouv.vitam.common.stream
Class MultiplePipedInputStream
- java.lang.Object
-
- fr.gouv.vitam.common.stream.MultiplePipedInputStream
-
- All Implemented Interfaces:
VitamAutoCloseable,java.lang.AutoCloseable
public class MultiplePipedInputStream extends java.lang.Object implements VitamAutoCloseable
Generate multiples InputStreams from one to many using Pipe
-
-
Constructor Summary
Constructors Constructor Description MultiplePipedInputStream(java.io.InputStream source, int nbCopy)Create one MultipleInputStreamHandler from one InputStream and make nbCopy linked InputStreams
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidcopy()java.io.InputStreamgetInputStream(int rank)Get the rank-th linked InputStreamvoidthrowLastException()
-
-
-
Constructor Detail
-
MultiplePipedInputStream
public MultiplePipedInputStream(java.io.InputStream source, int nbCopy)Create one MultipleInputStreamHandler from one InputStream and make nbCopy linked InputStreams- Parameters:
source-nbCopy-- Throws:
java.lang.IllegalArgumentException- if source is null or nbCopy <= 0 or global service is down
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream(int rank)
Get the rank-th linked InputStream- Parameters:
rank- between 0 and nbCopy-1- Returns:
- the rank-th linked InputStream
- Throws:
java.lang.IllegalArgumentException- if rank < 0 or rank >= nbCopy
-
throwLastException
public void throwLastException() throws java.io.IOException- Throws:
java.io.IOException- if any exception is found during multiple streams
-
copy
protected final void copy() throws java.io.IOException- Throws:
java.io.IOException
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceVitamAutoCloseable
-
-