Package fr.gouv.vitam.common.stream
Class MultiplePipedInputStream
java.lang.Object
fr.gouv.vitam.common.stream.MultiplePipedInputStream
- All Implemented Interfaces:
VitamAutoCloseable
,AutoCloseable
Generate multiples InputStreams from one to many using Pipe
-
Constructor Summary
ConstructorDescriptionMultiplePipedInputStream
(InputStream source, int nbCopy) Create one MultipleInputStreamHandler from one InputStream and make nbCopy linked InputStreams -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected final void
copy()
getInputStream
(int rank) Get the rank-th linked InputStreamvoid
-
Constructor Details
-
MultiplePipedInputStream
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
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
- Throws:
IOException
- if any exception is found during multiple streams
-
copy
- Throws:
IOException
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceVitamAutoCloseable
-