public class FileRandomStream extends RandomStream
READ_ONLY, READ_WRITE
Constructor and Description |
---|
FileRandomStream(File file,
String mode) |
FileRandomStream(File file,
String mode) |
FileRandomStream(String filePath,
String mode) |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method closes the stream.
|
static RandomStream |
toRandomStream(RandomAccessFile raf,
String mode)
Convert a RandomAccessFile to a RandomStream using the most efficient method.
|
canSetLength, flush, getLength, getPosition, isOpenForWriting, isReadWrite, mark, markSupported, reset, setLength, setMode, setPosition, skip, throwCantWrite, toOutputStream, validateMode, write, write, write
public FileRandomStream(String filePath, String mode) throws IllegalArgumentException, FileNotFoundException
filePath
- mode
- should be either "r" or "rw"IllegalArgumentException
FileNotFoundException
public FileRandomStream(File file, String mode) throws IllegalArgumentException, FileNotFoundException
file
- mode
- should be either "r" or "rw"IllegalArgumentException
FileNotFoundException
public FileRandomStream(File file, String mode) throws IllegalArgumentException, FileNotFoundException
file
- mode
- should be either "r" or "rw"IllegalArgumentException
FileNotFoundException
public static RandomStream toRandomStream(RandomAccessFile raf, String mode) throws IllegalArgumentException, IOException
raf
- the already open RandomAccessFile.mode
- the mode the RandomAccessFile is open for (either "r" or "rw").IllegalArgumentException
- if the mode is not "r" or "rw"IOException
- if the conversion could not be made for any reason.public void close() throws IOException
InputStream
IOException
This method does nothing in this class, but subclasses may override this method in order to provide additional functionality.
close
in class InputStream
IOException
- If an error occurs, which can only happen
in a subclass