public class SeekableFileInputStream extends SeekableInputStream
RandomAccessFile
in a SeekableInputStream.| Modifier and Type | Field and Description |
|---|---|
protected java.io.RandomAccessFile |
randomAccessFile
The RandomAccessFile that has been wrapped
into a SeekableFileInputStream.
|
| Constructor and Description |
|---|
SeekableFileInputStream(java.io.File file)
Creates a new seekable input stream that reads from the specified file.
|
SeekableFileInputStream(java.io.RandomAccessFile randomAccessFile)
Creates a new seekable input stream from an existing
RandomAccessFile object. |
SeekableFileInputStream(java.lang.String name)
Creates a new seekable input stream that reads from a file with
the specified name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Calls
randomAccessFile.close(). |
long |
length()
Calls
randomAccessFile.length(). |
long |
position()
Calls
randomAccessFile.getFilePointer(). |
int |
read()
Calls
randomAccessFile.read(). |
int |
read(byte[] buf)
Calls
randomAccessFile.read(buf). |
int |
read(byte[] buf,
int off,
int len)
Calls
randomAccessFile.read(buf, off, len). |
void |
seek(long pos)
Calls
randomAccessFile.seek(long). |
skipprotected java.io.RandomAccessFile randomAccessFile
public SeekableFileInputStream(java.io.File file)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic SeekableFileInputStream(java.lang.String name)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic SeekableFileInputStream(java.io.RandomAccessFile randomAccessFile)
RandomAccessFile object.public int read()
throws java.io.IOException
randomAccessFile.read().read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] buf)
throws java.io.IOException
randomAccessFile.read(buf).read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] buf,
int off,
int len)
throws java.io.IOException
randomAccessFile.read(buf, off, len).read in class java.io.InputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
randomAccessFile.close().close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic long length()
throws java.io.IOException
randomAccessFile.length().length in class SeekableInputStreamjava.io.IOExceptionpublic long position()
throws java.io.IOException
randomAccessFile.getFilePointer().position in class SeekableInputStreamjava.io.IOExceptionpublic void seek(long pos)
throws java.io.IOException
randomAccessFile.seek(long).seek in class SeekableInputStreampos - new read position in the streamjava.io.IOException - if pos is negative or if
a stream-specific I/O error occurs