Class MultiInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    @GwtIncompatible
    final class MultiInputStream
    extends java.io.InputStream
    An InputStream that concatenates multiple substreams. At most one stream will be open at a time.
    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.InputStream in  
      private java.util.Iterator<? extends ByteSource> it  
    • Constructor Summary

      Constructors 
      Constructor Description
      MultiInputStream​(java.util.Iterator<? extends ByteSource> it)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void advance()
      Closes the current input stream and opens the next one, if any.
      int available()  
      void close()  
      boolean markSupported()  
      int read()  
      int read​(byte[] b, int off, int len)  
      long skip​(long n)  
      • Methods inherited from class java.io.InputStream

        mark, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • it

        private java.util.Iterator<? extends ByteSource> it
      • in

        private java.io.InputStream in
    • Constructor Detail

      • MultiInputStream

        public MultiInputStream​(java.util.Iterator<? extends ByteSource> it)
                         throws java.io.IOException
        Creates a new instance.
        Parameters:
        it - an iterator of I/O suppliers that will provide each substream
        Throws:
        java.io.IOException
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • advance

        private void advance()
                      throws java.io.IOException
        Closes the current input stream and opens the next one, if any.
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.InputStream
        Throws:
        java.io.IOException