public class LZFCompressingInputStream extends InputStream
InputStream implementation used for
reading uncompressed data
and compressing it on the fly, such that reads return compressed
data.
It is reverse of LZFInputStream (which instead uncompresses data).LZFInputStream| Modifier and Type | Field and Description |
|---|---|
protected int |
_bufferLength
Length of the current uncompressed bytes buffer
|
protected int |
_bufferPosition
The current position (next char to output) in the uncompressed bytes buffer.
|
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 byte[] |
_encodedBytes
Buffer that contains compressed data that is returned to readers.
|
protected byte[] |
_inputBuffer
Buffer in which uncompressed input is first read, before getting
encoded in
_encodedBytes. |
protected InputStream |
_inputStream
Stream used for reading data to be compressed
|
protected boolean |
_inputStreamClosed
Flag that indicates if we have already called 'inputStream.close()'
(to avoid calling it multiple times)
|
protected int |
_readCount
Number of bytes read from the underlying
_inputStream |
| Constructor and Description |
|---|
LZFCompressingInputStream(ChunkEncoder encoder,
InputStream in) |
LZFCompressingInputStream(ChunkEncoder encoder,
InputStream in,
BufferRecycler bufferRecycler) |
LZFCompressingInputStream(InputStream in) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
int |
read() |
int |
read(byte[] buffer) |
int |
read(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
|
mark, markSupported, resetprotected final InputStream _inputStream
protected boolean _inputStreamClosed
protected boolean _cfgFullReads
protected byte[] _inputBuffer
_encodedBytes.protected byte[] _encodedBytes
protected int _bufferPosition
protected int _bufferLength
protected int _readCount
_inputStreampublic LZFCompressingInputStream(InputStream in)
public LZFCompressingInputStream(ChunkEncoder encoder, InputStream in)
public LZFCompressingInputStream(ChunkEncoder encoder, InputStream in, BufferRecycler bufferRecycler)
public void setUseFullReads(boolean b)
public int available()
available in class InputStreampublic int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] buffer)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] buffer,
int offset,
int length)
throws IOException
read in class InputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic long skip(long n)
throws IOException
skip in class InputStreamIOExceptionprotected boolean readyBuffer()
throws IOException
IOExceptionCopyright © 2014. All Rights Reserved.