Class DeflateCompressorOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class DeflateCompressorOutputStream
    extends CompressorOutputStream<java.util.zip.DeflaterOutputStream>
    Deflate compressor. Calling flush()

    Calling flush() flushes the encoder and calls outputStream.flush(). All buffered pending data will then be decompressible from the output stream. Calling this function very often may increase the compressed file size a lot.

    Since:
    1.9
    • Field Summary

      • Fields inherited from class java.io.FilterOutputStream

        out
    • Constructor Detail

      • DeflateCompressorOutputStream

        public DeflateCompressorOutputStream​(java.io.OutputStream outputStream)
        Creates a Deflate compressed output stream with the default parameters.
        Parameters:
        outputStream - the stream to wrap
      • DeflateCompressorOutputStream

        public DeflateCompressorOutputStream​(java.io.OutputStream outputStream,
                                             DeflateParameters parameters)
        Creates a Deflate compressed output stream with the specified parameters.
        Parameters:
        outputStream - the stream to wrap
        parameters - the deflate parameters to apply
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class CompressFilterOutputStream<java.util.zip.DeflaterOutputStream>
        Throws:
        java.io.IOException
      • finish

        public void finish()
                    throws java.io.IOException
        Finishes compression without closing the underlying stream.

        No more data can be written to this stream after finishing.

        Overrides:
        finish in class CompressFilterOutputStream<java.util.zip.DeflaterOutputStream>
        Throws:
        java.io.IOException - on error
      • flush

        public void flush()
                   throws java.io.IOException
        Flushes the encoder and calls outputStream.flush(). All buffered pending data will then be decompressible from the output stream. Calling this function very often may increase the compressed file size a lot.
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.FilterOutputStream
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] buf,
                          int off,
                          int len)
                   throws java.io.IOException
        Overrides:
        write in class java.io.FilterOutputStream
        Throws:
        java.io.IOException