Interface StreamCompression
access this type via: compress.algorithm.StreamCompression (provides, requires or uses)
--- semantic variants: deflate
Low-level compression API to compress data using a particular compression algorithm. The compressed data generated by this API does not include any file headers or meta-data, instead producing a raw compressed stream. This data is usually wrapped in a particular file format like zip or gzip.
Constants
byte DS_CONTINUE
byte DS_END
byte DS_ERROR
Functions
void compressInit()
byte[] compress(byte chunk[], bool lastChunk)
void compressEnd()
void decompressInit()
byte[] decompress(byte chunk[])
byte decompressStatus()
int decompressEnd()
Constants
DS_CONTINUE Status code returned by decompressStatus() to indicate that the compressed stream continues.
DS_END Status code returned by decompressStatus() to indicate that the compressed stream ended somewhere within the most recently issued chunk to decompress().
DS_ERROR Status code returned by decompressStatus() to indicate that there was a fatal error during decompression and the attempt should be aborted.
void compressInit()
Prepare the stream compressor to begin a new compression activity.
byte[] compress(byte chunk[], bool lastChunk)
Compresses the given chunk of data, returning the compressed version.
chunk Raw data chunk to compress.
lastChunk Must be set to true if this is the final chunk of data to be compressed for this stream.
returns: The compressed data.
void compressEnd()
Finish a stream compression activity.
void decompressInit()
Prepare the stream compressor to begin a new decompression activity.
byte[] decompress(byte chunk[])
Decompresses the given chunk of data, returning the decompressed version.
chunk Compressed chunk of data to decompress.
returns: The decompressed data corresponding to this chunk.
byte decompressStatus()
Query the status of the current decompression activity.
returns: This function returns DS_CONTINUE if the stream should continue; DS_END if the end of the compressed data has been reached somewhere within chunk, or DS_ERROR if a fatal error was encountered during decompression.
int decompressEnd()
Finish a stream decompression activity.
returns: The number of bytes of the final compressed data chunk (pass to decompress()) which were used before the end of the stream was reached. The remaining bytes of the last chunk were not part of this compressed data stream.