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 a
RandomAccessFile
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
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, skipNBytes, transferTo
-
Field Details
-
randomAccessFile
The RandomAccessFile that has been wrapped into a SeekableFileInputStream.
-
-
Constructor Details
-
SeekableFileInputStream
Creates a new seekable input stream that reads from the specified file.- Throws:
FileNotFoundException
-
SeekableFileInputStream
Creates a new seekable input stream that reads from a file with the specified name.- Throws:
FileNotFoundException
-
SeekableFileInputStream
Creates a new seekable input stream from an existingRandomAccessFile
object.
-
-
Method Details
-
read
CallsrandomAccessFile.read()
.- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
CallsrandomAccessFile.read(buf)
.- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
close
CallsrandomAccessFile.close()
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
length
CallsrandomAccessFile.length()
.- Specified by:
length
in classSeekableInputStream
- Throws:
IOException
-
position
- Specified by:
position
in classSeekableInputStream
- Throws:
IOException
-
seek
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
-