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, reset
protected 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
_inputStream
public 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 InputStream
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] buffer) throws IOException
read
in class InputStream
IOException
public int read(byte[] buffer, int offset, int length) throws IOException
read
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
protected boolean readyBuffer() throws IOException
IOException
Copyright © 2024. All rights reserved.