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) . |
skip
protected java.io.RandomAccessFile randomAccessFile
public SeekableFileInputStream(java.io.File file) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public SeekableFileInputStream(java.lang.String name) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public SeekableFileInputStream(java.io.RandomAccessFile randomAccessFile)
RandomAccessFile
object.public int read() throws java.io.IOException
randomAccessFile.read()
.read
in class java.io.InputStream
java.io.IOException
public int read(byte[] buf) throws java.io.IOException
randomAccessFile.read(buf)
.read
in class java.io.InputStream
java.io.IOException
public int read(byte[] buf, int off, int len) throws java.io.IOException
randomAccessFile.read(buf, off, len)
.read
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
randomAccessFile.close()
.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public long length() throws java.io.IOException
randomAccessFile.length()
.length
in class SeekableInputStream
java.io.IOException
public long position() throws java.io.IOException
randomAccessFile.getFilePointer()
.position
in class SeekableInputStream
java.io.IOException
public void seek(long pos) throws java.io.IOException
randomAccessFile.seek(long)
.seek
in class SeekableInputStream
pos
- new read position in the streamjava.io.IOException
- if pos
is negative or if
a stream-specific I/O error occurs