Пример #1
0
 /// <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);
 }
Пример #2
0
        public static byte[] GetCompressedChunk(byte[] buffer, int offset)
        {
            int compressedChunkLength = Codec.GetCompressedLength(buffer, offset);

            return(Utilities.ReadBlock(buffer, offset, compressedChunkLength));
        }
Пример #3
0
 /// <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));
 }
Пример #4
0
 /// <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));
 }