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 aRandomAccessFilein 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
All Methods Instance Methods Concrete Methods 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
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 existingRandomAccessFileobject.
-
-
Method Detail
-
read
public int read() throws IOExceptionCallsrandomAccessFile.read().- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] buf) throws IOExceptionCallsrandomAccessFile.read(buf).- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] buf, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
close
public void close() throws IOExceptionCallsrandomAccessFile.close().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
length
public long length() throws IOExceptionCallsrandomAccessFile.length().- Specified by:
lengthin classSeekableInputStream- Throws:
IOException
-
position
public long position() throws IOException- Specified by:
positionin classSeekableInputStream- Throws:
IOException
-
seek
public void seek(long pos) throws IOExceptionCallsrandomAccessFile.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
-
-