Class UnionInputStream

java.lang.Object
java.io.InputStream
org.eclipse.jgit.util.io.UnionInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class UnionInputStream extends InputStream
An InputStream which reads from one or more InputStreams.

This stream may enter into an EOF state, returning -1 from any of the read methods, and then later successfully read additional bytes if a new InputStream is added after reaching EOF.

Currently this stream does not support the mark/reset APIs. If mark and later reset functionality is needed the caller should wrap this stream with a BufferedInputStream.

  • Field Details

  • Constructor Details

    • UnionInputStream

      public UnionInputStream()
      Create an empty InputStream that is currently at EOF state.
    • UnionInputStream

      public UnionInputStream(InputStream... inputStreams)
      Create an InputStream that is a union of the individual streams.

      As each stream reaches EOF, it will be automatically closed before bytes from the next stream are read.

      Parameters:
      inputStreams - streams to be pushed onto this stream.
  • Method Details