Class 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
      void close()  
      protected void copy()  
      java.io.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 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:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface VitamAutoCloseable