Package 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:
Closeable
,AutoCloseable
- Direct Known Subclasses:
ReusableGZIPInputStream
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.
-
Field Summary
Fields inherited from class java.util.zip.InflaterInputStream
buf, inf, len
Fields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
ConstructorDescriptionBuild a new GZIP stream without a bound compressed stream.ResettableGZIPInputStream
(InputStream compressedStream) Warning - blocking! -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Does NOT call super.close(), as it cannot be reused if we do that.void
destroy()
Calls super.close().boolean
Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStreamlong
Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStreamlong
Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStreamlong
Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStreamvoid
initialize
(InputStream compressedStream) Blocking call to initialize this stream with the data from the given compressed stream.int
read()
int
read
(byte[] buf) int
read
(byte[] buf, int off, int len) toString()
Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStreamMethods inherited from class java.util.zip.InflaterInputStream
available, fill, mark, markSupported, reset, skip
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
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
Warning - blocking!- Throws:
IOException
-
-
Method Details
-
initialize
Blocking call to initialize this stream with the data from the given compressed stream.- Throws:
IOException
-
read
- Overrides:
read
in classInflaterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInflaterInputStream
- Throws:
IOException
-
getTotalRead
public long getTotalRead()Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStream- Since:
- 0.8.9
-
getTotalExpanded
public long getTotalExpanded()Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStream- Since:
- 0.8.9
-
getRemaining
public long getRemaining()Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStream- Since:
- 0.8.9
-
getFinished
public boolean getFinished()Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStream- Since:
- 0.8.9
-
destroy
Calls super.close(). May not be reused after this.- Throws:
IOException
- Since:
- 0.9.40
-
close
Does NOT call super.close(), as it cannot be reused if we do that. Broken before 0.9.20.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInflaterInputStream
- Throws:
IOException
- Since:
- 0.9.20
-
toString
Moved from i2ptunnel HTTPResponseOutputStream.InternalGZIPInputStream
-