|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FileInputStream
com.ning.compress.lzf.util.LZFFileInputStream
public class LZFFileInputStream
Helper class that allows use of LZF compression even if a library requires
use of FileInputStream
.
Note that use of this class is not recommended unless you absolutely must
use a FileInputStream
instance; otherwise basic LZFInputStream
(which uses aggregation for underlying streams) is more appropriate
Implementation note: much of the code is just copied from LZFInputStream
,
so care must be taken to keep implementations in sync if there are fixes.
Field Summary | |
---|---|
protected boolean |
_cfgFullReads
Flag that indicates whether we force full reads (reading of as many bytes as requested), or 'optimal' reads (up to as many as available, but at least one). |
protected boolean |
inputStreamClosed
Flag that indicates if we have already called 'inputStream.close()' (to avoid calling it multiple times) |
Constructor Summary | |
---|---|
LZFFileInputStream(File file)
|
|
LZFFileInputStream(FileDescriptor fdObj)
|
|
LZFFileInputStream(String name)
|
Method Summary | |
---|---|
int |
available()
|
void |
close()
|
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] buffer,
int offset,
int length)
|
protected int |
readRaw(byte[] buffer,
int offset,
int length)
|
protected boolean |
readyBuffer()
Fill the uncompressed bytes buffer by reading the underlying inputStream. |
void |
setUseFullReads(boolean b)
Method that can be used define whether reads should be "full" or "optimal": former means that full compressed blocks are read right away as needed, optimal that only smaller chunks are read at a time, more being read as needed. |
long |
skip(long n)
Overridden to just skip at most a single chunk at a time |
Methods inherited from class java.io.FileInputStream |
---|
finalize, getChannel, getFD |
Methods inherited from class java.io.InputStream |
---|
mark, markSupported, reset |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean inputStreamClosed
protected boolean _cfgFullReads
Constructor Detail |
---|
public LZFFileInputStream(File file) throws FileNotFoundException
FileNotFoundException
public LZFFileInputStream(FileDescriptor fdObj)
public LZFFileInputStream(String name) throws FileNotFoundException
FileNotFoundException
Method Detail |
---|
public void setUseFullReads(boolean b)
public int available()
available
in class FileInputStream
public void close() throws IOException
close
in interface Closeable
close
in class FileInputStream
IOException
public int read() throws IOException
read
in class FileInputStream
IOException
public int read(byte[] b) throws IOException
read
in class FileInputStream
IOException
public int read(byte[] buffer, int offset, int length) throws IOException
read
in class FileInputStream
IOException
public long skip(long n) throws IOException
skip
in class FileInputStream
IOException
protected boolean readyBuffer() throws IOException
IOException
protected final int readRaw(byte[] buffer, int offset, int length) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |