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 aRandomAccessFile
in a SeekableInputStream.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.RandomAccessFile
randomAccessFile
The 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 existingRandomAccessFile
object.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 void
close()
CallsrandomAccessFile.close()
.long
length()
CallsrandomAccessFile.length()
.long
position()
CallsrandomAccessFile.getFilePointer()
.int
read()
CallsrandomAccessFile.read()
.int
read(byte[] buf)
CallsrandomAccessFile.read(buf)
.int
read(byte[] buf, int off, int len)
CallsrandomAccessFile.read(buf, off, len)
.void
seek(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.FileNotFoundException
Creates 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.FileNotFoundException
Creates 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 existingRandomAccessFile
object.
-
-
Method Detail
-
read
public int read() throws java.io.IOException
CallsrandomAccessFile.read()
.- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] buf) throws java.io.IOException
CallsrandomAccessFile.read(buf)
.- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] buf, int off, int len) throws java.io.IOException
CallsrandomAccessFile.read(buf, off, len)
.- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
CallsrandomAccessFile.close()
.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
length
public long length() throws java.io.IOException
CallsrandomAccessFile.length()
.- Specified by:
length
in classSeekableInputStream
- Throws:
java.io.IOException
-
position
public long position() throws java.io.IOException
CallsrandomAccessFile.getFilePointer()
.- Specified by:
position
in classSeekableInputStream
- Throws:
java.io.IOException
-
seek
public void seek(long pos) throws java.io.IOException
CallsrandomAccessFile.seek(long)
.- Specified by:
seek
in classSeekableInputStream
- Parameters:
pos
- new read position in the stream- Throws:
java.io.IOException
- ifpos
is negative or if a stream-specific I/O error occurs
-
-