GetCompressionStream Method

Creates an output stream used to write compressed data.

Syntax

public java.io.OutputStream getCompressionStream(java.io.OutputStream baseStream);

Remarks

GetCompressionStream returns a java.io.OutputStream used to compress data as it is written to an underlying stream. The BaseStream parameter should be the java.io.OutputStream to which the compressed data will be written.

The format (zlib or gzip) is selected with the StreamFormat property; Deflate is the default. Note that the stream, once created, is independent of the class.

The return value provides the following standard java.io.OutputStream methods. Please see the official Java documentation for details.

public void close() throws IOException

Closes the stream. Also closes BaseStream if CloseBaseStream is set to true before this stream is created.

public void flush() throws IOException

Flushes the output stream, and forces all data to be compressed and written to the underlying stream. Caution: Flush only when necessary, as repeated flushing may degrade the compression ratio.

public void write(int b) throws IOException

Compresses and writes the byte b to the underlying stream.

public void write(byte[] b) public void write(byte[] b, int off, int len)

Compresses and writes the byte array b to the underlying stream.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks ZIP 2020 Java Edition - Version 20.0 [Build 8300]