org.jets3t.service.io
Class RepeatableFileInputStream
java.lang.Object
java.io.InputStream
org.jets3t.service.io.RepeatableFileInputStream
- All Implemented Interfaces:
- java.io.Closeable, InputStreamWrapper
- Direct Known Subclasses:
- SegmentedRepeatableFileInputStream
public class RepeatableFileInputStream
- extends java.io.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
Method Summary |
int |
available()
|
void |
close()
|
java.io.InputStream |
getWrappedInputStream()
|
void |
mark(int readlimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(byte[] arg0,
int arg1,
int arg2)
|
void |
reset()
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. |
long |
skip(long toSkip)
|
Methods inherited from class java.io.InputStream |
read |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RepeatableFileInputStream
public RepeatableFileInputStream(java.io.File file)
throws java.io.FileNotFoundException
- Creates a repeatable input stream based on a file.
- Parameters:
file
-
- Throws:
java.io.FileNotFoundException
skip
public long skip(long toSkip)
throws java.io.IOException
- Overrides:
skip
in class java.io.InputStream
- Throws:
java.io.IOException
reset
public void reset()
throws java.io.IOException
- 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.
- Overrides:
reset
in class java.io.InputStream
- Throws:
UnrecoverableIOException
- when the FileInputStream cannot be re-created.
java.io.IOException
markSupported
public boolean markSupported()
- Overrides:
markSupported
in class java.io.InputStream
mark
public void mark(int readlimit)
- Overrides:
mark
in class java.io.InputStream
available
public int available()
throws java.io.IOException
- Overrides:
available
in class java.io.InputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Overrides:
close
in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Specified by:
read
in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read(byte[] arg0,
int arg1,
int arg2)
throws java.io.IOException
- Overrides:
read
in class java.io.InputStream
- Throws:
java.io.IOException
getWrappedInputStream
public java.io.InputStream getWrappedInputStream()
- Specified by:
getWrappedInputStream
in interface InputStreamWrapper
- Returns:
- the underlying input stream wrapped by this class.