Package org.tukaani.xz
Class SeekableFileInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.tukaani.xz.SeekableInputStream
-
- org.tukaani.xz.SeekableFileInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class SeekableFileInputStream extends SeekableInputStream
Wraps aRandomAccessFilein a SeekableInputStream.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.RandomAccessFilerandomAccessFileThe RandomAccessFile that has been wrapped into a SeekableFileInputStream.
-
Constructor Summary
Constructors Constructor 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 existingRandomAccessFileobject.SeekableFileInputStream(java.lang.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()CallsrandomAccessFile.getFilePointer().intread()CallsrandomAccessFile.read().intread(byte[] buf)CallsrandomAccessFile.read(buf).intread(byte[] buf, int off, int len)CallsrandomAccessFile.read(buf, off, len).voidseek(long pos)CallsrandomAccessFile.seek(long).-
Methods inherited from class org.tukaani.xz.SeekableInputStream
skip
-
-
-
-
Constructor Detail
-
SeekableFileInputStream
public SeekableFileInputStream(java.io.File file) throws java.io.FileNotFoundExceptionCreates a new seekable input stream that reads from the specified file.- Throws:
java.io.FileNotFoundException
-
SeekableFileInputStream
public SeekableFileInputStream(java.lang.String name) throws java.io.FileNotFoundExceptionCreates a new seekable input stream that reads from a file with the specified name.- Throws:
java.io.FileNotFoundException
-
SeekableFileInputStream
public SeekableFileInputStream(java.io.RandomAccessFile randomAccessFile)
Creates a new seekable input stream from an existingRandomAccessFileobject.
-
-
Method Detail
-
read
public int read() throws java.io.IOExceptionCallsrandomAccessFile.read().- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] buf) throws java.io.IOExceptionCallsrandomAccessFile.read(buf).- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] buf, int off, int len) throws java.io.IOExceptionCallsrandomAccessFile.read(buf, off, len).- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCallsrandomAccessFile.close().- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
length
public long length() throws java.io.IOExceptionCallsrandomAccessFile.length().- Specified by:
lengthin classSeekableInputStream- Throws:
java.io.IOException
-
position
public long position() throws java.io.IOExceptionCallsrandomAccessFile.getFilePointer().- Specified by:
positionin classSeekableInputStream- Throws:
java.io.IOException
-
seek
public void seek(long pos) throws java.io.IOExceptionCallsrandomAccessFile.seek(long).- Specified by:
seekin classSeekableInputStream- Parameters:
pos- new read position in the stream- Throws:
java.io.IOException- ifposis negative or if a stream-specific I/O error occurs
-
-