Closeable, AutoCloseablepublic class SeekableFileInputStream extends SeekableInputStream
RandomAccessFile
in a SeekableInputStream.| Modifier and Type | Field | Description |
|---|---|---|
protected RandomAccessFile |
randomAccessFile |
The RandomAccessFile that has been wrapped
into a SeekableFileInputStream.
|
| Constructor | Description |
|---|---|
SeekableFileInputStream(File file) |
Creates a new seekable input stream that reads from the specified file.
|
SeekableFileInputStream(RandomAccessFile randomAccessFile) |
Creates a new seekable input stream from an existing
RandomAccessFile object. |
SeekableFileInputStream(String name) |
Creates a new seekable input stream that reads from a file with
the specified name.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Calls
randomAccessFile.close(). |
long |
length() |
Calls
randomAccessFile.length(). |
long |
position() |
|
int |
read() |
Calls
randomAccessFile.read(). |
int |
read(byte[] buf) |
Calls
randomAccessFile.read(buf). |
int |
read(byte[] buf,
int off,
int len) |
|
void |
seek(long pos) |
Calls
randomAccessFile.seek(long). |
available, mark, markSupported, readAllBytes, readNBytes, reset, transferToclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitskipprotected RandomAccessFile randomAccessFile
public SeekableFileInputStream(File file) throws FileNotFoundException
FileNotFoundExceptionpublic SeekableFileInputStream(String name) throws FileNotFoundException
FileNotFoundExceptionpublic SeekableFileInputStream(RandomAccessFile randomAccessFile)
RandomAccessFile object.public int read()
throws IOException
randomAccessFile.read().read in class InputStreamIOExceptionpublic int read(byte[] buf)
throws IOException
randomAccessFile.read(buf).read in class InputStreamIOExceptionpublic int read(byte[] buf,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic void close()
throws IOException
randomAccessFile.close().close in interface AutoCloseableclose in interface Closeableclose in class InputStreamIOExceptionpublic long length()
throws IOException
randomAccessFile.length().length in class SeekableInputStreamIOExceptionpublic long position()
throws IOException
position in class SeekableInputStreamIOExceptionpublic void seek(long pos)
throws IOException
randomAccessFile.seek(long).seek in class SeekableInputStreampos - new read position in the streamIOException - if pos is negative or if
a stream-specific I/O error occurs