Package com.iizix.util
Class GZOutputStream
- java.lang.Object
- java.io.OutputStream
- java.io.FilterOutputStream
- java.util.zip.DeflaterOutputStream
- com.iizix.util.GZOutputStream
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public final class GZOutputStream extends java.util.zip.DeflaterOutputStream
Modified version of Java's GZIPOutputStream to perform BEST compression!- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description GZOutputStream(java.io.OutputStream out)
Creates a new output stream with the 16 KB buffer size and without flushing.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finish()
Finishes writing compressed data to the output stream without closing the underlying stream.void
write(byte[] buf, int off, int len)
Writes array of bytes to the compressed output stream.
Method Detail
write
public void write(byte[] buf, int off, int len) throws java.io.IOException
Writes array of bytes to the compressed output stream. This method will block until all the bytes are written.- Overrides:
write
in classjava.util.zip.DeflaterOutputStream
- Parameters:
buf
- The data to be written.off
- The start offset of the data.len
- The length of the data.- Throws:
java.io.IOException
- If an I/O error has occurred.
finish
public void finish() throws java.io.IOException
Finishes 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:
finish
in classjava.util.zip.DeflaterOutputStream
- Throws:
java.io.IOException
- if an I/O error has occurred.