Package org.tukaani.xz
Class SeekableFileInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.tukaani.xz.SeekableInputStream
-
- org.tukaani.xz.SeekableFileInputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class SeekableFileInputStream extends SeekableInputStream
Wraps aRandomAccessFile
in a SeekableInputStream.
-
-
Field Summary
Fields Modifier and Type Field Description protected RandomAccessFile
randomAccessFile
The RandomAccessFile that has been wrapped into a SeekableFileInputStream.
-
Constructor Summary
Constructors 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 existingRandomAccessFile
object.SeekableFileInputStream(String name)
Creates a new seekable input stream that reads from a file with the specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
CallsrandomAccessFile.close()
.long
length()
CallsrandomAccessFile.length()
.long
position()
int
read()
CallsrandomAccessFile.read()
.int
read(byte[] buf)
CallsrandomAccessFile.read(buf)
.int
read(byte[] buf, int off, int len)
void
seek(long pos)
CallsrandomAccessFile.seek(long)
.-
Methods inherited from class org.tukaani.xz.SeekableInputStream
skip
-
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, transferTo
-
-
-
-
Field Detail
-
randomAccessFile
protected RandomAccessFile randomAccessFile
The RandomAccessFile that has been wrapped into a SeekableFileInputStream.
-
-
Constructor Detail
-
SeekableFileInputStream
public SeekableFileInputStream(File file) throws FileNotFoundException
Creates a new seekable input stream that reads from the specified file.- Throws:
FileNotFoundException
-
SeekableFileInputStream
public SeekableFileInputStream(String name) throws FileNotFoundException
Creates a new seekable input stream that reads from a file with the specified name.- Throws:
FileNotFoundException
-
SeekableFileInputStream
public SeekableFileInputStream(RandomAccessFile randomAccessFile)
Creates a new seekable input stream from an existingRandomAccessFile
object.
-
-
Method Detail
-
read
public int read() throws IOException
CallsrandomAccessFile.read()
.- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] buf) throws IOException
CallsrandomAccessFile.read(buf)
.- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] buf, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
public void close() throws IOException
CallsrandomAccessFile.close()
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
length
public long length() throws IOException
CallsrandomAccessFile.length()
.- Specified by:
length
in classSeekableInputStream
- Throws:
IOException
-
position
public long position() throws IOException
- Specified by:
position
in classSeekableInputStream
- Throws:
IOException
-
seek
public void seek(long pos) throws IOException
CallsrandomAccessFile.seek(long)
.- Specified by:
seek
in classSeekableInputStream
- Parameters:
pos
- new read position in the stream- Throws:
IOException
- ifpos
is negative or if a stream-specific I/O error occurs
-
-