Package com.ning.compress.gzip
Class OptimizedGZIPInputStream
java.lang.Object
java.io.InputStream
com.ning.compress.gzip.OptimizedGZIPInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Optimized variant of
GZIPInputStream
that
reuses underlying Deflater
instance}.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
Enumeration used for keeping track of decoding state within stream -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]
protected int
protected int
protected final BufferRecycler
Object that handles details of buffer recyclingprotected final CRC32
protected final GZIPRecycler
protected Inflater
protected InputStream
Underlying input stream from which compressed data is to be read from.protected OptimizedGZIPInputStream.State
Flag set to true during handling of header processingprotected byte[]
Temporary buffer used for single-byte reads, skipping.private static final int
What kinds of chunks do we feed underlyingInflater
? -
Constructor Summary
ConstructorsConstructorDescriptionOptimizedGZIPInputStream
(InputStream in, BufferRecycler bufferRecycler, GZIPRecycler gzipRecycler) -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
private final void
private final void
_loadMore
(int max) private final int
protected final void
private final int
_readInt()
private final int
protected final void
private final void
_skipBytes
(int count) int
void
close()
void
mark
(int limit) boolean
final int
read()
final int
read
(byte[] buf) final 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, skipNBytes, transferTo
-
Field Details
-
INPUT_BUFFER_SIZE
private static final int INPUT_BUFFER_SIZEWhat kinds of chunks do we feed underlyingInflater
?- See Also:
-
_inflater
-
_crc
-
_bufferRecycler
Object that handles details of buffer recycling -
_gzipRecycler
-
_buffer
protected byte[] _buffer -
_bufferPtr
protected int _bufferPtr -
_bufferEnd
protected int _bufferEnd -
_tmpBuffer
protected byte[] _tmpBufferTemporary buffer used for single-byte reads, skipping. -
_rawInput
Underlying input stream from which compressed data is to be read from. -
_state
Flag set to true during handling of header processing
-
-
Constructor Details
-
OptimizedGZIPInputStream
- Throws:
IOException
-
OptimizedGZIPInputStream
public OptimizedGZIPInputStream(InputStream in, BufferRecycler bufferRecycler, GZIPRecycler gzipRecycler) throws IOException - Throws:
IOException
-
-
Method Details
-
available
public int available()- Overrides:
available
in classInputStream
-
close
- 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
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
_getTmpBuffer
protected byte[] _getTmpBuffer() -
_readHeader
- Throws:
IOException
-
_readTrailer
- Throws:
IOException
-
_skipBytes
- Throws:
IOException
-
_readByte
- Throws:
IOException
-
_readShort
- Throws:
IOException
-
_readInt
- Throws:
IOException
-
_loadMore
- Throws:
IOException
-
_loadMore
- Throws:
IOException
-