Package com.ning.compress.gzip
Class OptimizedGZIPInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.ning.compress.gzip.OptimizedGZIPInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class OptimizedGZIPInputStream extends InputStream
Optimized variant ofGZIPInputStreamthat reuses underlyingDeflaterinstance}.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]_bufferprotected int_bufferEndprotected int_bufferPtrprotected BufferRecycler_bufferRecyclerObject that handles details of buffer recyclingprotected CRC32_crcprotected GZIPRecycler_gzipRecyclerprotected Inflater_inflaterprotected InputStream_rawInputUnderlying input stream from which compressed data is to be read from.protected com.ning.compress.gzip.OptimizedGZIPInputStream.State_stateFlag set to true during handling of header processingprotected byte[]_tmpBufferTemporary buffer used for single-byte reads, skipping.
-
Constructor Summary
Constructors Constructor Description OptimizedGZIPInputStream(InputStream in)OptimizedGZIPInputStream(InputStream in, BufferRecycler bufferRecycler, GZIPRecycler gzipRecycler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]_getTmpBuffer()protected void_readHeader()protected void_readTrailer()intavailable()voidclose()voidmark(int limit)booleanmarkSupported()intread()intread(byte[] buf)intread(byte[] buf, int offset, int len)voidreset()longskip(long n)-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Field Detail
-
_inflater
protected Inflater _inflater
-
_crc
protected final 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 InputStream _rawInput
Underlying input stream from which compressed data is to be read from.
-
_state
protected com.ning.compress.gzip.OptimizedGZIPInputStream.State _state
Flag set to true during handling of header processing
-
-
Constructor Detail
-
OptimizedGZIPInputStream
public OptimizedGZIPInputStream(InputStream in) throws IOException
- Throws:
IOException
-
OptimizedGZIPInputStream
public OptimizedGZIPInputStream(InputStream in, BufferRecycler bufferRecycler, GZIPRecycler gzipRecycler) throws IOException
- Throws:
IOException
-
-
Method Detail
-
available
public int available()
- Overrides:
availablein classInputStream
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
mark
public void mark(int limit)
- Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
read
public final int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public final int read(byte[] buf) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
read
public final int read(byte[] buf, int offset, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
_getTmpBuffer
protected byte[] _getTmpBuffer()
-
_readHeader
protected final void _readHeader() throws IOException- Throws:
IOException
-
_readTrailer
protected final void _readTrailer() throws IOException- Throws:
IOException
-
-