BinaryFormat is the contract for serializing messages to and from binary data. Implementations may be specific to a proto syntax, and can be reflection based, or delegate to speed optimized generated code.

interface BinaryFormat {
    discardUnknownFields(message): void;
    listUnknownFields(message): readonly {
        data: Uint8Array;
        no: number;
        wireType: WireType;
    }[];
    makeReadOptions(options?): Readonly<BinaryReadOptions>;
    makeWriteOptions(options?): Readonly<BinaryWriteOptions>;
    onUnknownField(message, no, wireType, data): void;
    readMessage(message, reader, lengthOrEndTagFieldNo, options, delimitedMessageEncoding?): void;
    writeMessage(message, writer, options): void;
    writeUnknownFields(message, writer): void;
}

Methods

  • Discard unknown fields for the given message.

    Parameters

    Returns void

  • Retrieve the unknown fields for the given message.

    Unknown fields are well-formed protocol buffer serialized data for fields that the parserdoes not recognize.

    For more details see https://developers.google.com/protocol-buffers/docs/proto3#unknowns

    Parameters

    Returns readonly {
        data: Uint8Array;
        no: number;
        wireType: WireType;
    }[]

  • Store an unknown field for the given message. The parser will use this method if it does not recognize a field, unless the option readUnknownFields has been disabled.

    Parameters

    Returns void

  • Parse a message from binary data, merging fields.

    Supports two message encodings:

    • length-prefixed: delimitedMessageEncoding is false or omitted, and lengthOrEndTagFieldNo is the expected length of the message in the reader.
    • delimited: delimitedMessageEncoding is true, and lengthOrEndTagFieldNo is the field number in a tag with wire type end-group signalling the end of the message in the reader.

    delimitedMessageEncoding is optional for backwards compatibility.

    Parameters

    Returns void

  • Serialize a message to binary data.

    Parameters

    Returns void

  • Retrieve the unknown fields for the given message and write them to the given writer. This method is called when a message is serialized, so the fields that are unknown to the parser persist through a round trip.

    Parameters

    Returns void

Generated using TypeDoc