Package com.ning.compress.gzip
Class OptimizedGZIPInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.ning.compress.gzip.OptimizedGZIPInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class OptimizedGZIPInputStream extends java.io.InputStreamOptimized variant ofGZIPInputStreamthat reuses underlyingDeflaterinstance}.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classOptimizedGZIPInputStream.StateEnumeration used for keeping track of decoding state within stream
-
Field Summary
Fields Modifier and Type Field Description protected byte[]_bufferprotected int_bufferEndprotected int_bufferPtrprotected BufferRecycler_bufferRecyclerObject that handles details of buffer recyclingprotected java.util.zip.CRC32_crcprotected GZIPRecycler_gzipRecyclerprotected java.util.zip.Inflater_inflaterprotected java.io.InputStream_rawInputUnderlying input stream from which compressed data is to be read from.protected OptimizedGZIPInputStream.State_stateFlag set to true during handling of header processingprotected byte[]_tmpBufferTemporary buffer used for single-byte reads, skipping.private static intINPUT_BUFFER_SIZEWhat kinds of chunks do we feed underlyingInflater?
-
Constructor Summary
Constructors Constructor Description OptimizedGZIPInputStream(java.io.InputStream in)OptimizedGZIPInputStream(java.io.InputStream in, BufferRecycler bufferRecycler, GZIPRecycler gzipRecycler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]_getTmpBuffer()private void_loadMore()private void_loadMore(int max)private int_readByte()protected void_readHeader()private int_readInt()private int_readShort()protected void_readTrailer()private void_skipBytes(int count)intavailable()voidclose()voidmark(int limit)booleanmarkSupported()intread()intread(byte[] buf)intread(byte[] buf, int offset, int len)voidreset()longskip(long n)
-
-
-
Field Detail
-
INPUT_BUFFER_SIZE
private static final int INPUT_BUFFER_SIZE
What kinds of chunks do we feed underlyingInflater?- See Also:
- Constant Field Values
-
_inflater
protected java.util.zip.Inflater _inflater
-
_crc
protected final java.util.zip.CRC32 _crc
-
_bufferRecycler
protected final BufferRecycler _bufferRecycler
Object that handles details of buffer recycling
-
_gzipRecycler
protected final GZIPRecycler _gzipRecycler
-
_buffer
protected byte[] _buffer
-
_bufferPtr
protected int _bufferPtr
-
_bufferEnd
protected int _bufferEnd
-
_tmpBuffer
protected byte[] _tmpBuffer
Temporary buffer used for single-byte reads, skipping.
-
_rawInput
protected java.io.InputStream _rawInput
Underlying input stream from which compressed data is to be read from.
-
_state
protected OptimizedGZIPInputStream.State _state
Flag set to true during handling of header processing
-
-
Constructor Detail
-
OptimizedGZIPInputStream
public OptimizedGZIPInputStream(java.io.InputStream in) throws java.io.IOException- Throws:
java.io.IOException
-
OptimizedGZIPInputStream
public OptimizedGZIPInputStream(java.io.InputStream in, BufferRecycler bufferRecycler, GZIPRecycler gzipRecycler) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
available
public int available()
- Overrides:
availablein classjava.io.InputStream
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
mark
public void mark(int limit)
- Overrides:
markin classjava.io.InputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classjava.io.InputStream
-
read
public final int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public final int read(byte[] buf) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public final int read(byte[] buf, int offset, int len) throws java.io.IOException- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOException- Overrides:
resetin classjava.io.InputStream- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException
-
_getTmpBuffer
protected byte[] _getTmpBuffer()
-
_readHeader
protected final void _readHeader() throws java.io.IOException- Throws:
java.io.IOException
-
_readTrailer
protected final void _readTrailer() throws java.io.IOException- Throws:
java.io.IOException
-
_skipBytes
private final void _skipBytes(int count) throws java.io.IOException- Throws:
java.io.IOException
-
_readByte
private final int _readByte() throws java.io.IOException- Throws:
java.io.IOException
-
_readShort
private final int _readShort() throws java.io.IOException- Throws:
java.io.IOException
-
_readInt
private final int _readInt() throws java.io.IOException- Throws:
java.io.IOException
-
_loadMore
private final void _loadMore() throws java.io.IOException- Throws:
java.io.IOException
-
_loadMore
private final void _loadMore(int max) throws java.io.IOException- Throws:
java.io.IOException
-
-