Package com.linkedin.venice.compression
Class ReusableGzipOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.util.zip.DeflaterOutputStream
com.linkedin.venice.compression.ReusableGzipOutputStream
- All Implemented Interfaces:
- Closeable,- Flushable,- AutoCloseable
This class implements a stream filter for writing compressed data in the GZIP file format. It's an adoption of
 
GZIPOutputStream but with a notable difference regarding re-usability:
 - Expose reset()to reset CRC32 and the deflater
- Don't write the GZIP header upon construction but expose writeHeader()
- 
Field SummaryFields inherited from class java.util.zip.DeflaterOutputStreambuf, defFields inherited from class java.io.FilterOutputStreamout
- 
Constructor SummaryConstructors
- 
Method SummaryMethods inherited from class java.util.zip.DeflaterOutputStreamclose, deflate, flush, writeMethods inherited from class java.io.FilterOutputStreamwriteMethods inherited from class java.io.OutputStreamnullOutputStream
- 
Constructor Details- 
ReusableGzipOutputStream
 
- 
- 
Method Details- 
toByteArraypublic byte[] toByteArray()
- 
writeWrites array of bytes to the compressed output stream. This method will block until all the bytes are written.- Overrides:
- writein class- DeflaterOutputStream
- Parameters:
- buf- the data to be written
- off- the start offset of the data
- len- the length of the data
- Throws:
- IOException- If an I/O error has occurred.
 
- 
finishFinishes writing compressed data to the output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream.- Overrides:
- finishin class- DeflaterOutputStream
- Throws:
- IOException- if an I/O error has occurred
 
- 
writeHeader- Throws:
- IOException
 
- 
resetpublic void reset()
 
-