Class CodecService | DOTS Runtime | 0.26.0-preview.14
docs.unity3d.com
    Show / Hide Table of Contents

    Class CodecService

    Provides codec agnostic helper functions for compression/decompression

    Inheritance
    Object
    CodecService
    Namespace: Unity.Tiny.Codec
    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
    Type Name Description
    Codec codec
    Byte* src
    Int32 srcSize
    Byte* dst
    Allocator allocator
    Returns
    Type Description
    Int32

    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
    Type Name Description
    Codec codec
    Int32 size
    Returns
    Type Description
    Int32

    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
    Type Description
    Boolean
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023