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 ofGZIPInputStream
that reuses underlyingDeflater
instance}.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]
_buffer
protected int
_bufferEnd
protected int
_bufferPtr
protected BufferRecycler
_bufferRecycler
Object that handles details of buffer recyclingprotected CRC32
_crc
protected GZIPRecycler
_gzipRecycler
protected Inflater
_inflater
protected InputStream
_rawInput
Underlying input stream from which compressed data is to be read from.protected com.ning.compress.gzip.OptimizedGZIPInputStream.State
_state
Flag set to true during handling of header processingprotected byte[]
_tmpBuffer
Temporary 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()
int
available()
void
close()
void
mark(int limit)
boolean
markSupported()
int
read()
int
read(byte[] buf)
int
read(byte[] buf, int offset, int len)
void
reset()
long
skip(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:
available
in classInputStream
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
mark
public void mark(int limit)
- Overrides:
mark
in classInputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classInputStream
-
read
public final int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public final int read(byte[] buf) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public final int read(byte[] buf, int offset, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
reset
public void reset() throws IOException
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
skip
public long skip(long n) throws IOException
- Overrides:
skip
in 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
-
-