@@ -0,0 +1,1987 @@
+package org.cobbzilla.util.io;%0A%0Aimport lombok.extern.slf4j.Slf4j;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A@Slf4j%0Apublic class MultiStream extends InputStream %7B%0A%0A    private final List%3CInputStream%3E streams = new ArrayList%3C%3E();%0A    private InputStream currentStream;%0A    private int streamIndex = 0;%0A    private boolean endOfStreams = false;%0A%0A    public MultiStream (InputStream r, boolean last) %7B%0A        if (last) %7B%0A            addLastStream(r);%0A        %7D else %7B%0A            addStream(r);%0A        %7D%0A        currentStream = r;%0A    %7D%0A%0A    public MultiStream (InputStream r) %7B this(r, false); %7D%0A%0A    public void addStream (InputStream in) %7B%0A        if (endOfStreams) %7B%0A            log.warn(%22addStream: endOfStreams is true, not adding InputStream%22);%0A        %7D else %7B%0A            streams.add(in);%0A        %7D%0A    %7D%0A%0A    public void addLastStream (InputStream in) %7B%0A        addStream(in);%0A        endOfStreams = true;%0A    %7D%0A%0A    @Override public int read() throws IOException %7B%0A        int val = currentStream.read();%0A        if (val == -1) %7B%0A            if (streamIndex == streams.size()-1) %7B%0A                return endOfStreams ? -1 : 0;%0A            %7D%0A            currentStream.close();%0A            streamIndex++;%0A            currentStream = streams.get(streamIndex);%0A            return read();%0A        %7D%0A        return val;%0A    %7D%0A%0A    @Override public int read(byte%5B%5D buf, int off, int len) throws IOException %7B%0A        int count = currentStream.read(buf, off, len);%0A        if (count == -1) %7B%0A            if (streamIndex == streams.size()-1) %7B%0A                return endOfStreams ? -1 : 0;%0A            %7D%0A            currentStream.close();%0A            streamIndex++;%0A            currentStream = streams.get(streamIndex);%0A            return read(buf, off, len);%0A        %7D%0A        return count;%0A    %7D%0A%0A    @Override public void close() throws IOException %7B%0A        if (currentStream != null) currentStream.close();%0A    %7D%0A%0A%7D%0A

add MultiStream class