formats.zlib - ICE 0.1 API documentation

ICE 0.1 API documentation

# formats.zlib

Zlib compression and decompression.

class CompressionException: object.Exception;

  Exception thrown at errors related to compression (such as zlib).

enum CompressionStrategy;

  Zlib compression strategy.

ubyte[] zlibInflate(const ubyte[] input, const uint reserve = 0);

  Decompress data compressed with Zlib.

  Parameters:

  ubyte[] input | Data to decompress.
  uint reserve | Expected size of decompressed data, used to reserve space for decompression. 0 (default) means automatic.

  Returns:
  Decompressed data.
  Throws:
  CompressionException if the data could not be decompressed.
struct Inflator;

  Buffered Zlib decompressor. Used to decompress Zlib data piece by piece.

  Stores compressed data in an outside vector.

  this(ref Vector!(ubyte) inflated);

    Construct an Inflator.

    Parameters:

    Vector!(ubyte) inflated | Vector to write decompressed data to. Any existing data in the vector will be overwritten.

  void inflate(const ubyte[] input);

    Decompress a piece of data.

    Throws:
    CompressionException if the data could not be decompressed.
ubyte[] zlibDeflate(const ubyte[] source, const CompressionStrategy strategy = (CompressionStrategy).RLE, const uint level = 9);

  Compress data using Zlib.

  Parameters:

  ubyte[] source | Data to compress.
  CompressionStrategy strategy | Zlib compression strategy to use.
  uint level | Compression level. Must be at least 0 and at most 9.

  Returns:
  Compressed data.
void zlibDeflate(ref Vector!(ubyte) result, const ubyte[] source, const CompressionStrategy strategy = (CompressionStrategy).RLE, const uint level = 9);

  Compress data using Zlib.

  Parameters:

  Vector!(ubyte) result | Compressed data will be written here.
  ubyte[] source | Data to compress.
  CompressionStrategy strategy | Zlib compression strategy to use.
  uint level | Compression level. Must be at least 0 and at most 9.

  Returns:
  Compressed data.
package bool zlibCheckCRC(const uint crc, const ubyte[] data);

  Check CRC using zlib CRC32 function.

  Parameters:

  uint crc | CRC32 to check.
  ubyte[] data | Data to check CRC of.

  Returns:
  True if CRC matches, false otherwise.
package uint zlibCRC(const ubyte[] data);

  Generate CRC using zlib CRC32 function.

  Parameters:

  ubyte[] data | Data to generate CRC for.

  Returns:
  Generated CRC32.
void deflate_(Buffer)(ref Buffer result, const ubyte[] source, const CompressionStrategy strategy, const uint level);

  Compress data using Zlib (implementation).

  Parameters:

  result | Compressed data will be written here.
  source | Data to compress.
  strategy | Zlib compression strategy to use.
  level | Compression level. Must be at least 0 and at most 9.

  Returns:
  Compressed data.
ubyte* getPtr(Buffer)(ref Buffer buf);

  Utility for deflate_ to access array and vector pointers uniformly

Copyright © Ferdinand Majerech 2011. | Page generated by AutoDDoc and Ddoc.