net.i2p.util
Class ResettableGZIPInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.util.zip.InflaterInputStream
net.i2p.util.ResettableGZIPInputStream
- All Implemented Interfaces:
- java.io.Closeable
- Direct Known Subclasses:
- ReusableGZIPInputStream
public class ResettableGZIPInputStream
- extends java.util.zip.InflaterInputStream
GZIP implementation per
RFC 1952, reusing
java's standard CRC32 and Inflater and InflaterInputStream implementations.
The main difference is that this implementation allows its state to be
reset to initial values, and hence reused, while the standard
GZIPInputStream reads the GZIP header from the stream on instantiation.
Fields inherited from class java.util.zip.InflaterInputStream |
buf, inf, len |
Fields inherited from class java.io.FilterInputStream |
in |
Method Summary |
(package private) long |
getCurrentCRCVal()
|
void |
initialize(java.io.InputStream compressedStream)
Blocking call to initialize this stream with the data from the given
compressed stream. |
static void |
main(java.lang.String[] args)
|
int |
read()
|
int |
read(byte[] buf)
|
int |
read(byte[] buf,
int off,
int len)
|
(package private) void |
verifyFooter()
|
Methods inherited from class java.util.zip.InflaterInputStream |
available, close, fill, mark, markSupported, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ResettableGZIPInputStream
public ResettableGZIPInputStream()
- Build a new GZIP stream without a bound compressed stream. You need
to initialize this with initialize(compressedStream) when you want to
decompress a stream.
ResettableGZIPInputStream
public ResettableGZIPInputStream(java.io.InputStream compressedStream)
throws java.io.IOException
- Throws:
java.io.IOException
initialize
public void initialize(java.io.InputStream compressedStream)
throws java.io.IOException
- Blocking call to initialize this stream with the data from the given
compressed stream.
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Overrides:
read
in class java.util.zip.InflaterInputStream
- Throws:
java.io.IOException
read
public int read(byte[] buf)
throws java.io.IOException
- Overrides:
read
in class java.io.FilterInputStream
- Throws:
java.io.IOException
read
public int read(byte[] buf,
int off,
int len)
throws java.io.IOException
- Overrides:
read
in class java.util.zip.InflaterInputStream
- Throws:
java.io.IOException
getCurrentCRCVal
long getCurrentCRCVal()
verifyFooter
void verifyFooter()
throws java.io.IOException
- Throws:
java.io.IOException
main
public static void main(java.lang.String[] args)