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 RandomAccessFilerandomAccessFileThe 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 existingRandomAccessFileobject.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 voidclose()CallsrandomAccessFile.close().longlength()CallsrandomAccessFile.length().longposition()intread()CallsrandomAccessFile.read().intread(byte[] buf)CallsrandomAccessFile.read(buf).intread(byte[] buf, int off, int len)voidseek(long pos)CallsrandomAccessFile.seek(long).Methods inherited from class org.tukaani.xz.SeekableInputStream
skipMethods 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 existingRandomAccessFileobject.
-
-
Method Details
-
read
CallsrandomAccessFile.read().- Specified by:
readin classInputStream- Throws:
IOException
-
read
CallsrandomAccessFile.read(buf).- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
close
CallsrandomAccessFile.close().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
length
CallsrandomAccessFile.length().- Specified by:
lengthin classSeekableInputStream- Throws:
IOException
-
position
- Specified by:
positionin classSeekableInputStream- Throws:
IOException
-
seek
CallsrandomAccessFile.seek(long).- Specified by:
seekin classSeekableInputStream- Parameters:
pos- new read position in the stream- Throws:
IOException- ifposis negative or if a stream-specific I/O error occurs
-