@@ -0,0 +1,3124 @@
+/*%0A * The MIT License (MIT)%0A *%0A * Copyright (c) 2015 Lachlan Dowding%0A *%0A * Permission is hereby granted, free of charge, to any person obtaining a copy%0A * of this software and associated documentation files (the %22Software%22), to deal%0A * in the Software without restriction, including without limitation the rights%0A * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0A * copies of the Software, and to permit persons to whom the Software is%0A * furnished to do so, subject to the following conditions:%0A *%0A * The above copyright notice and this permission notice shall be included in all%0A * copies or substantial portions of the Software.%0A *%0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE%0A * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER%0A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0A * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE%0A * SOFTWARE.%0A */%0A%0Apackage permafrost.tundra.io;%0A%0Aimport java.io.*;%0A%0Apublic class MarkableInputStream extends FilterInputStream %7B%0A    /**%0A     * Creates a new MarkableInputStream, which wraps the given input stream%0A     * object in a stream that supports the mark and reset methods.%0A     *%0A     * To provide support for mark and reset methods to a given input stream,%0A     * this class creates a temporary backing file, then copies the entire%0A     * contents of the given stream to the file, and then uses the file%0A     * for reading the MarkableInputStream.%0A     *%0A     * @param inputStream   The stream to be wrapped.%0A     * @throws IOException  If an I/O error occurs while reading from the stream.%0A     */%0A    public MarkableInputStream(InputStream inputStream) throws IOException %7B%0A        super(inputStream);%0A%0A        File backingFile = FileHelper.create();%0A        FileHelper.writeFromStream(backingFile, inputStream, false);%0A        in = new DeleteOnCloseFileInputStream(backingFile);%0A    %7D%0A%0A    /**%0A     * Returns true because this class supports marking and resetting the stream.%0A     * @return True because this class supports marking and resetting the stream.%0A     */%0A    @Override%0A    public boolean markSupported() %7B%0A        return true;%0A    %7D%0A%0A    /**%0A     * Marks the current position in this input stream. A subsequent call to the reset%0A     * method repositions this stream at the last marked position so that subsequent%0A     * reads re-read the same bytes.%0A     * @param readLimit This parameter is ignored.%0A     */%0A    @Override%0A    public synchronized void mark(int readLimit) %7B%0A        in.mark(readLimit);%0A    %7D%0A%0A    /**%0A     * Repositions this stream to the position at the time the mark method was last called on%0A     * this input stream, or to the start of the stream if the mark method has never been called.%0A     * @throws IOException If an I/O error occurs.%0A     */%0A    @Override%0A    public synchronized void reset() throws IOException %7B%0A        in.reset();%0A    %7D%0A%7D%0A

Add MarkableInputStream class