InputStream implementation used for reading compressed data
and uncompressing it on the fly, such that reads return uncompressed
data. Its direct counterpart is LZFOutputStream; but there is
also LZFCompressingInputStream which does reverse of this class.
com.ning.compress.lzf.util.LZFFileInputStream , com.ning.compress.lzf.LZFCompressingInputStream
| 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[] | _decodedBytes
the buffer of uncompressed bytes from which content is read |
| protected final ChunkDecoder | _decoder
Underlying decoder in use. |
| protected byte[] | _inputBuffer
the current buffer of compressed bytes (from which to decode) |
| protected final InputStream | _inputStream
stream to be decompressed |
| protected boolean | _inputStreamClosed
Flag that indicates if we have already called 'inputStream.close()' (to avoid calling it multiple times) |
| protected final BufferRecycler | _recycler
Object that handles details of buffer recycling |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | LZFInputStream(final InputStream
Underlying input stream to use in, boolean Whether fullReads)read(byte[]) should try to read exactly
as many bytes as requested (true); or just however many happen to be
available (false)
|
| public | |
| public | |
| public | LZFInputStream(final InputStream
Underlying input stream to use in, final BufferRecycler Buffer recycler instance, for usages where the
caller manages the recycler instances bufferRecycler, boolean Whether fullReads)read(byte[]) should try to read exactly
as many bytes as requested (true); or just however many happen to be
available (false)
|
| public | LZFInputStream(final ChunkDecoder decoder, final InputStream in, final BufferRecycler bufferRecycler, boolean fullReads)
|
| Modifier and Type | Method and Description |
|---|---|
| public int | available()
Overrides java. |
| public void | close()
Overrides java. Implements java. |
| public void | discardBuffered()
Method that can be called to discard any already buffered input, read from input source. |
| public InputStream | getUnderlyingInputStream()
Method that can be used to find underlying |
| public int | read()
Implements abstract java. |
| public int | read(final byte[]
the buffer into which the data is read. buffer)Overrides java. b.
|
| public int | read(final byte[]
the buffer into which the data is read. buffer, int the start offset in array offset, int b
at which the data is written.the maximum number of bytes to read. length)Overrides java. len bytes of data from the input stream into
an array of bytes.
|
| public int | Returns: Number of bytes written (uncompressed)OutputStream to use for writing content out)Convenience method that will read and uncompress all data available,
and write it using given |
| protected boolean | Returns: True if there is now at least one byte to read in the buffer; false if there is no more content to readFill the uncompressed bytes buffer by reading the underlying inputStream. |
| public 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. |
| public long | skip(long
the number of bytes to be skipped. n)Overrides java. |
| _bufferLength | back to summary |
|---|---|
| protected int _bufferLength Length of the current uncompressed bytes buffer | |
| _bufferPosition | back to summary |
|---|---|
| protected int _bufferPosition The current position (next char to output) in the uncompressed bytes buffer. | |
| _cfgFullReads | back to 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). Default is false, meaning that 'optimal' read is used. | |
| _decodedBytes | back to summary |
|---|---|
| protected byte[] _decodedBytes the buffer of uncompressed bytes from which content is read | |
| _decoder | back to summary |
|---|---|
| protected final ChunkDecoder _decoder Underlying decoder in use. | |
| _inputBuffer | back to summary |
|---|---|
| protected byte[] _inputBuffer the current buffer of compressed bytes (from which to decode) | |
| _inputStream | back to summary |
|---|---|
| protected final InputStream _inputStream stream to be decompressed | |
| _inputStreamClosed | back to summary |
|---|---|
| protected boolean _inputStreamClosed Flag that indicates if we have already called 'inputStream.close()' (to avoid calling it multiple times) | |
| _recycler | back to summary |
|---|---|
| protected final BufferRecycler _recycler Object that handles details of buffer recycling | |
| LZFInputStream | back to summary |
|---|---|
| public LZFInputStream(final InputStream inputStream) throws IOException | |
| LZFInputStream | back to summary |
|---|---|
| public LZFInputStream(final ChunkDecoder decoder, final InputStream in) throws IOException | |
| LZFInputStream | back to summary |
|---|---|
public LZFInputStream(final InputStream in, boolean fullReads) throws IOException
| |
| LZFInputStream | back to summary |
|---|---|
| public LZFInputStream(final ChunkDecoder decoder, final InputStream in, boolean fullReads) throws IOException | |
| LZFInputStream | back to summary |
|---|---|
| public LZFInputStream(final InputStream inputStream, final BufferRecycler bufferRecycler) throws IOException | |
| LZFInputStream | back to summary |
|---|---|
public LZFInputStream(final InputStream in, final BufferRecycler bufferRecycler, boolean fullReads) throws IOException
| |
| LZFInputStream | back to summary |
|---|---|
| public LZFInputStream(final ChunkDecoder decoder, final InputStream in, final BufferRecycler bufferRecycler, boolean fullReads) throws IOException | |
| available | back to summary |
|---|---|
| public int available() Overrides java. Method is overridden to report number of bytes that can now be read from decoded data buffer, without reading bytes from the underlying stream. Never throws an exception; returns number of bytes available without further reads from underlying source; -1 if stream has been closed, or 0 if an actual read (and possible blocking) is needed to find out.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this input stream and releases any system resources associated with the stream.
| |
| discardBuffered | back to summary |
|---|---|
| public void discardBuffered() Method that can be called to discard any already buffered input, read
from input source.
Specialized method that only makes sense if the underlying | |
| getUnderlyingInputStream | back to summary |
|---|---|
| public InputStream getUnderlyingInputStream() Method that can be used to find underlying | |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract java. Doc from java. Reads the next byte of data from the input stream. The value byte is
returned as an
| |
| read | back to summary |
|---|---|
| public int read(final byte[] buffer) throws IOException Overrides java. Doc from java. Reads some number of bytes from the input stream and stores them into
the buffer array If the length of The first byte read is stored into element
| |
| read | back to summary |
|---|---|
| public int read(final byte[] buffer, int offset, int length) throws IOException Overrides java. Doc from java. Reads up to This method blocks until input data is available, end of file is detected, or an exception is thrown. If The first byte read is stored into element In every case, elements
| |
| readAndWrite | back to summary |
|---|---|
| public int readAndWrite(OutputStream out) throws IOException Convenience method that will read and uncompress all data available,
and write it using given
| |
| readyBuffer | back to summary |
|---|---|
| protected boolean readyBuffer() throws IOException Fill the uncompressed bytes buffer by reading the underlying inputStream.
| |
| setUseFullReads | back to summary |
|---|---|
| public 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. | |
| skip | back to summary |
|---|---|
| public long skip(long n) throws IOException Overrides java. Overridden to implement efficient skipping by skipping full chunks whenever possible.
| |