Class prominence.io.MarkResetFileInputStream
All Packages Class Hierarchy This Package Previous Next Index
Class prominence.io.MarkResetFileInputStream
java.lang.Object
|
+----java.io.InputStream
|
+----java.io.FileInputStream
|
+----prominence.io.MarkResetFileInputStream
- public class MarkResetFileInputStream
- extends FileInputStream
A FileInputStream that supports the mark()
and reset() methods.
-
file
- The file that is being read.
-
markedPos
- The last market position in the file.
-
MarkResetFileInputStream(RandomAccessFile)
- Creates a MarkResetFileInputStream that reads from the
specified RandomAccessFile.
-
create(String)
- This method creates a new MarkResetFileInputStream
that reads from the specified file.
-
mark(int)
- Marks the current position in the file.
-
markSupported()
- Returns that the mark() and reset() methods are
supported.
-
reset()
- Resets the file pointer to the previously marked position.
markedPos
protected long markedPos
- The last market position in the file.
file
protected RandomAccessFile file
- The file that is being read.
MarkResetFileInputStream
public MarkResetFileInputStream(RandomAccessFile file)
- Creates a MarkResetFileInputStream that reads from the
specified RandomAccessFile.
- Parameters:
- file - The RandomAccessFile to read from
create
public static MarkResetFileInputStream create(String fileName) throws IOException
- This method creates a new MarkResetFileInputStream
that reads from the specified file.
- Parameters:
- fileName - The name of the file to read
- Returns:
- A new MarkResetFileInputStream
- Throws: IOException
- Occurs if the file cannot be opened for reading.
- Throws: SecurityException
- Occurs if the SecurityManager
denies the operation.
markSupported
public boolean markSupported()
- Returns that the mark() and reset() methods are
supported.
- Overrides:
- markSupported in class InputStream
mark
public void mark(int n)
- Marks the current position in the file.
- Parameters:
- n - The maximum number of bytes that may be read before
reset() is called
- Overrides:
- mark in class InputStream
reset
public void reset() throws IOException
- Resets the file pointer to the previously marked position.
- Throws: IOException
- Occurs if no mark has been set or if an
error occurs while resetting the position.
- Overrides:
- reset in class InputStream
All Packages Class Hierarchy This Package Previous Next Index