Class GZOutputStream

All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public final class GZOutputStream extends DeflaterOutputStream
Modified version of Java's GZIPOutputStream to perform BEST compression!
Author:
Christopher Mindus
  • Constructor Details

    • GZOutputStream

      public GZOutputStream(OutputStream out) throws IOException
      Creates a new output stream with the 16 KB buffer size and without flushing.
      Parameters:
      out - The output stream.
      Throws:
      IOException - If an I/O error has occurred.
  • Method Details

    • write

      public void write(byte[] buf, int off, int len) throws IOException
      Writes array of bytes to the compressed output stream. This method will block until all the bytes are written.
      Overrides:
      write in 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.
    • finish

      public void finish() throws 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 class DeflaterOutputStream
      Throws:
      IOException - if an I/O error has occurred.