Class CodecService
Provides codec agnostic helper functions for compression/decompression
Syntax
public static class CodecService
Methods
Compress(Codec, Byte*, Int32, out Byte*, Allocator)
Compresses the passed in src
data into newly allocated dst
buffer. Users must free dst
manually after calling Compress
Declaration
public static int Compress(Codec codec, in byte *src, int srcSize, out byte *dst, Allocator allocator = null)
Parameters
Returns
CompressUpperBound(Codec, Int32)
Return the maximum size that a codec may output in a "worst case" scenario when compressing data
Declaration
public static int CompressUpperBound(Codec codec, int size)
Parameters
Returns
Decompress(Codec, Byte*, Int32, Byte*, Int32)
Decompresses data in src
buffer and returns true with the decompressed data stored in the passed in, previously allocated decompressedData
buffer.
Users thus should know ahead of time how large a decompressedData
buffer to use before calling this function. Not
passing a large enough buffer will result in this function failing and returning false.
Declaration
public static bool Decompress(Codec codec, in byte *compressedData, int compressedSize, byte *decompressedData, int decompressedSize)
Parameters
Type |
Name |
Description |
Codec |
codec |
|
Byte* |
compressedData |
|
Int32 |
compressedSize |
|
Byte* |
decompressedData |
|
Int32 |
decompressedSize |
|
Returns