@@ -0,0 +1,3913 @@
+/*%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 MarkableFileInputStream extends FileInputStream %7B%0A    /**%0A     * The marked position that will be returned to upon calling the reset() method.%0A     */%0A    private long mark = 0;%0A%0A    /**%0A     * Creates a FileInputStream by opening a connection to an actual file named by the%0A     * given File object.%0A     * @param file                      The file to read from.%0A     * @throws FileNotFoundException    If the file does not exist, is a directory rather%0A     *                                  than a regular file, or for some other reason cannot%0A     *                                  be opened for reading.%0A     */%0A    public MarkableFileInputStream(File file) throws FileNotFoundException %7B%0A        super(file);%0A    %7D%0A%0A    /**%0A     * Creates a FileInputStream by opening a connection to an actual file named by the%0A     * given FileDescriptor object.%0A     * @param descriptor                The file descriptor to read from.%0A     */%0A    public MarkableFileInputStream(FileDescriptor descriptor) %7B%0A        super(descriptor);%0A    %7D%0A%0A    /**%0A     * Creates a FileInputStream by opening a connection to an actual file with the given name.%0A     * @param filename                  The file to read from.%0A     * @throws FileNotFoundException    If the file does not exist, is a directory rather%0A     *                                  than a regular file, or for some other reason cannot%0A     *                                  be opened for reading.%0A     */%0A    public MarkableFileInputStream(String filename) throws FileNotFoundException %7B%0A        super(filename);%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        try %7B%0A            mark = getChannel().position();%0A        %7D catch (IOException ex) %7B%0A            throw new RuntimeException(ex);%0A        %7D%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        getChannel().position(mark);%0A    %7D%0A%7D%0A

Add MarkableFileInputStream class