Codec | WebHare Platform SDK
WebHare Platform SDK
    Preparing search index...

    Type Alias Codec<In, Out>

    Codec: {
        decodeBinary: (
            buffer: UndocumentedBuffer,
            dataview: DataView,
            offset: number,
            len: number,
        ) => Out;
        encodeBinary: (builder: RequestBuilder, value: In) => null | void;
        jitDecoder?: (retval: string, codecExpr: string) => string;
        jitDecoderContext?: unknown;
        name: string;
        oid: number;
    } & (
        | { arrayEltCodec?: never; test: CodecTest }
        | { arrayEltCodec: Codec<any, any>; test?: never }
    )

    Type Parameters

    • In
    • Out

    Type declaration

    • decodeBinary: (
          buffer: UndocumentedBuffer,
          dataview: DataView,
          offset: number,
          len: number,
      ) => Out

      Function to decode the binary representation of this type. The data is in the buffer at buffer[offset] and dataview[offset] with length len.

    • encodeBinary: (builder: RequestBuilder, value: In) => null | void
    • OptionaljitDecoder?: (retval: string, codecExpr: string) => string

      Optional JIT decoder function for this type.

    • OptionaljitDecoderContext?: unknown

      Context for the JIT decoder.

    • name: string
    • oid: number
    • { arrayEltCodec?: never; test: CodecTest }
      • OptionalarrayEltCodec?: never
      • test: CodecTest

        Tests whether a value matches this codec

    • { arrayEltCodec: Codec<any, any>; test?: never }
      • arrayEltCodec: Codec<any, any>

        When this codec is for an array type, contains the codec for the element type

      • Optionaltest?: never