ResettableInputStream extends ReleasableInputStream { @Override public void reset() throws IOException { abortIfNeeded(); fileChannel.position(markPos); if (log.isTraceEnabled()) log.trace("Reset to position " + markPos); } ResettableInputStream(File file);  ResettableInputStream(FileInputStream fis); private  ResettableInputStream(FileInputStream fis, File file); @Override final boolean markSupported(); @Override void mark(int _); @Override void reset(); @Override int available(); @Override int read(); @Override long skip(long n); @Override int read(byte[] arg0, int arg1, int arg2); File getFile(); static ResettableInputStream newResettableInputStream(File file); static ResettableInputStream newResettableInputStream(File file,
            String errmsg); static ResettableInputStream newResettableInputStream(
            FileInputStream fis); static ResettableInputStream newResettableInputStream(
            FileInputStream fis, String errmsg);  }
@Test public void testResetWithClosedFile() throws IOException { ResettableInputStream is = new ResettableInputStream(file).disableClose(); final String content = IOUtils.toString(is); is.close(); is.reset(); final String content2 = IOUtils.toString(is); assertTrue(content.length() == 100); assertEquals(content, content2); is.release(); }
@Test(expected=ClosedChannelException.class) public void negativeTestResetWithClosedFile() throws IOException { ResettableInputStream is = new ResettableInputStream(file); is.close(); is.reset(); }
@Test(expected=ClosedChannelException.class) public void testMarkAndResetClosedFileInputStream() throws IOException { ResettableInputStream is = new ResettableInputStream(new FileInputStream(file)); is.close(); is.reset(); }