@Override public int available() throws IOException { abortIfNeeded(); return fis.available(); }
@Override public long skip(long n) throws IOException { abortIfNeeded(); long skipped = fis.skip(n); bytesReadPastMarkPoint += skipped; return skipped; }
@Override public int read() throws IOException { abortIfNeeded(); int byteRead = fis.read(); if (byteRead != -1) { bytesReadPastMarkPoint++; return byteRead; } else { return -1; } }
@Override public void close() throws IOException { fis.close(); abortIfNeeded(); }
@Override public int read(byte[] arg0, int arg1, int arg2) throws IOException { abortIfNeeded(); int count = fis.read(arg0, arg1, arg2); bytesReadPastMarkPoint += count; return count; }
@Override public void mark(int readlimit) { abortIfNeeded(); this.markPoint += bytesReadPastMarkPoint; this.bytesReadPastMarkPoint = 0; if (log.isDebugEnabled()) { log.debug("Input stream marked at " + this.markPoint + " bytes"); } }
/** * Resets the input stream to the last mark point, or the beginning of the * stream if there is no mark point, by creating a new FileInputStream based * on the underlying file. * * @throws IOException * when the FileInputStream cannot be re-created. */ @Override public void reset() throws IOException { this.fis.close(); abortIfNeeded(); this.fis = new FileInputStream(file); long skipped = 0; long toSkip = markPoint; while (toSkip > 0) { skipped = this.fis.skip(toSkip); toSkip -= skipped; } if (log.isDebugEnabled()) { log.debug("Reset to mark point " + markPoint + " after returning " + bytesReadPastMarkPoint + " bytes"); } this.bytesReadPastMarkPoint = 0; }
@Override public int available() throws IOException { abortIfNeeded(); return fis.available(); }
@Override public int read() throws IOException { abortIfNeeded(); int byteRead = fis.read(); if (byteRead != -1) { bytesReadPastMarkPoint++; return byteRead; } else { return -1; } }
@Override public void close() throws IOException { fis.close(); abortIfNeeded(); }
@Override public long skip(long n) throws IOException { abortIfNeeded(); long skipped = fis.skip(n); bytesReadPastMarkPoint += skipped; return skipped; }
@Override public int read(byte[] arg0, int arg1, int arg2) throws IOException { abortIfNeeded(); int count = fis.read(arg0, arg1, arg2); bytesReadPastMarkPoint += count; return count; }
@Override public void mark(int readlimit) { abortIfNeeded(); this.markPoint += bytesReadPastMarkPoint; this.bytesReadPastMarkPoint = 0; if (log.isDebugEnabled()) { log.debug("Input stream marked at " + this.markPoint + " bytes"); } }
/** * Resets the input stream to the last mark point, or the beginning of the * stream if there is no mark point, by creating a new FileInputStream based * on the underlying file. * * @throws IOException when the FileInputStream cannot be re-created. */ @Override public void reset() throws IOException { this.fis.close(); abortIfNeeded(); this.fis = new FileInputStream(file); long skipped = 0; long toSkip = markPoint; while (toSkip > 0) { skipped = this.fis.skip(toSkip); toSkip -= skipped; } if (log.isDebugEnabled()) { log.debug("Reset to mark point " + markPoint + " after returning " + bytesReadPastMarkPoint + " bytes"); } this.bytesReadPastMarkPoint = 0; }
@Override public int read(byte[] arg0, int arg1, int arg2) throws IOException { abortIfNeeded(); int count = fis.read(arg0, arg1, arg2); bytesReadPastMarkPoint += count; return count; }
@Override public long skip(long n) throws IOException { abortIfNeeded(); long skipped = fis.skip(n); bytesReadPastMarkPoint += skipped; return skipped; }
@Override public long skip(long n) throws IOException { abortIfNeeded(); long skipped = fis.skip(n); bytesReadPastMarkPoint += skipped; return skipped; }
@Override public int read() throws IOException { abortIfNeeded(); int byteRead = fis.read(); if (byteRead != -1) { bytesReadPastMarkPoint++; return byteRead; } else { return -1; } }
@Override public int read() throws IOException { abortIfNeeded(); int byteRead = fis.read(); if (byteRead != -1) { bytesReadPastMarkPoint++; return byteRead; } else { return -1; } }
@Override public void mark(int readlimit) { abortIfNeeded(); this.markPoint += bytesReadPastMarkPoint; this.bytesReadPastMarkPoint = 0; if (log.isDebugEnabled()) { log.debug("Input stream marked at " + this.markPoint + " bytes"); } }