Class MultipleInputStream

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class MultipleInputStream
    extends InputStream
    A multiple input stream.

    Instances of this class encapsulate a sequence of input streams. When one of the streams is exhausted, the multiple stream behaves as if on an end of file. However, after calling reset() the stream is again readable, and positioned at the start of the following stream.

    • Method Detail

      • getStream

        public static InputStream getStream​(InputStream[] inputStream,
                                            int offset,
                                            int length)
        Returns an input stream encapsulating a nonempty fragment of an array of input streams.
        Parameters:
        inputStream - an array of input streams, that will be encapsulated.
        offset - the first input stream that will be encapsulated.
        length - the number of input streams to be encapsulated.
        Returns:
        an input stream encapsulating the argument streams (the only argument, if length is 1).
      • getStream

        public static InputStream getStream​(InputStream[] inputStream)
        Returns an input stream encapsulating a nonempty array of input streams.

        Note that if inputStream.length is 1 this method will return the only stream that should be encapsulated.

        Parameters:
        inputStream - an array of input streams, that will be encapsulated.
        Returns:
        an input stream encapsulating the argument streams (the only argument, if the length is 1).