GetDecompressionStream Method

Creates an input stream used to read data from a compressed stream.

Syntax

public java.io.InputStream getDecompressionStream(java.io.InputStream baseStream);

Remarks

GetDecompressionStream returns a java.io.InputStream used to read the decompressed data from a compressed stream. The BaseStream parameter should be the java.io.InputStream providing the compressed data.

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.InputStream 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 int read() throws IOException

Reads a single byte of data from the input stream. Returns -1 if no data was able to be read.

public int read(byte[] b) throws IOException public int read(byte[] b, int off, int len) throws IOException

Reads decompressed data into the provided byte array, and returns the number of bytes actually read. Returns -1 if the stream was finished.

public long skip(long n) throws IOException

Attempts to skip n bytes of (decompressed) data, and returns the number of bytes actually skipped.

Other methods (such as reset) are defined, but do nothing special, and will return default values or throw exceptions as defined by the Java API.

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