Package org.jets3t.service.io
Class RepeatableFileInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.jets3t.service.io.RepeatableFileInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable,InputStreamWrapper
- Direct Known Subclasses:
SegmentedRepeatableFileInputStream
public class RepeatableFileInputStream extends InputStream implements InputStreamWrapper
A repeatable input stream for files. This input stream can be repeated an unlimited number of times, without any limitation on when a repeat can occur.- Author:
- James Murty
-
-
Constructor Summary
Constructors Constructor Description RepeatableFileInputStream(File file)Creates a repeatable input stream based on a file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()InputStreamgetWrappedInputStream()voidmark(int readlimit)booleanmarkSupported()intread()intread(byte[] arg0, int arg1, int arg2)voidreset()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.longskip(long toSkip)-
Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
RepeatableFileInputStream
public RepeatableFileInputStream(File file) throws FileNotFoundException
Creates a repeatable input stream based on a file.- Parameters:
file-- Throws:
FileNotFoundException
-
-
Method Detail
-
skip
public long skip(long toSkip) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
reset
public void reset() throws IOExceptionResets 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.- Overrides:
resetin classInputStream- Throws:
UnrecoverableIOException- when the FileInputStream cannot be re-created.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
mark
public void mark(int readlimit)
- Overrides:
markin classInputStream
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] arg0, int arg1, int arg2) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
getWrappedInputStream
public InputStream getWrappedInputStream()
- Specified by:
getWrappedInputStreamin interfaceInputStreamWrapper- Returns:
- the underlying input stream wrapped by this class.
-
-