/// <summary> /// Compresses the data of a passed buffer into a destination buffer, /// starting at the offset value. /// </summary> /// <param name="sourceBuffer">The data to be compressed.</param> /// <param name="destinationBuffer">The buffer where the compressed data will be saved.</param> /// <param name="offset">Location where the data will be saved.</param> public static void Compress(byte[] sourceBuffer, byte[] destinationBuffer, int offset) { byte[] compBuffer = Codec.Compress(sourceBuffer); Buffer.BlockCopy(compBuffer, 0, destinationBuffer, offset, compBuffer.Length); }
public static byte[] GetCompressedChunk(byte[] buffer, int offset) { int compressedChunkLength = Codec.GetCompressedLength(buffer, offset); return(Utilities.ReadBlock(buffer, offset, compressedChunkLength)); }
/// <summary> /// Compresses the data of the passed buffer. /// </summary> /// <param name="buffer">The data to be compressed.</param> /// <returns>The compressed data.</returns> public static byte[] Compress(byte[] buffer) { return(Codec.Compress(buffer, false)); }
/// <summary> /// Computes the length of a compressed data block. /// </summary> /// <param name="buffer">The compressed data block.</param> /// <returns>The length of the compressed block.</returns> public static int GetCompressedLength(byte[] buffer) { return(Codec.GetCompressedLength(buffer, 0)); }