<PackageReference Include="Google.Protobuf" Version="3.35.1" />

Google.Protobuf.WritingPrimitives

static class WritingPrimitives
Primitives for encoding protobuf wire format.
public static uint EncodeZigZag32(int n)

Encode a 32-bit value with ZigZag encoding.

public static ulong EncodeZigZag64(long n)

Encode a 64-bit value with ZigZag encoding.

public static void WriteBool(ref Span buffer, ref WriterInternalState state, bool value)

Writes a bool field value, without a tag, to the stream.

public static void WriteBytes(ref Span buffer, ref WriterInternalState state, ByteString value)

Write a byte string, without a tag, to the stream. The data is length-prefixed.

public static void WriteDouble(ref Span buffer, ref WriterInternalState state, double value)

Writes a double field value, without a tag, to the stream.

public static void WriteEnum(ref Span buffer, ref WriterInternalState state, int value)

Writes an enum value, without a tag, to the stream.

public static void WriteFixed32(ref Span buffer, ref WriterInternalState state, uint value)

Writes a fixed32 field value, without a tag, to the stream.

public static void WriteFixed64(ref Span buffer, ref WriterInternalState state, ulong value)

Writes a fixed64 field value, without a tag, to the stream.

public static void WriteFloat(ref Span buffer, ref WriterInternalState state, float value)

Writes a float field value, without a tag, to the stream.

public static void WriteInt32(ref Span buffer, ref WriterInternalState state, int value)

Writes an int32 field value, without a tag, to the stream.

public static void WriteInt64(ref Span buffer, ref WriterInternalState state, long value)

Writes an int64 field value, without a tag, to the stream.

public static void WriteLength(ref Span buffer, ref WriterInternalState state, int length)

Writes a length (in bytes) for length-delimited data.

public static void WriteRawBytes(ref Span buffer, ref WriterInternalState state, byte[] value)

Writes out an array of bytes.

public static void WriteRawBytes(ref Span buffer, ref WriterInternalState state, byte[] value, int offset, int length)

Writes out part of an array of bytes.

public static void WriteRawBytes(ref Span buffer, ref WriterInternalState state, ReadOnlySpan<byte> value)

Writes out part of an array of bytes.

public static void WriteRawLittleEndian32(ref Span buffer, ref WriterInternalState state, uint value)

public static void WriteRawLittleEndian64(ref Span buffer, ref WriterInternalState state, ulong value)

public static void WriteRawLittleEndian64SlowPath(ref Span buffer, ref WriterInternalState state, ulong value)

public static void WriteRawTag(ref Span buffer, ref WriterInternalState state, byte b1)

Writes the given single-byte tag directly to the stream.

public static void WriteRawTag(ref Span buffer, ref WriterInternalState state, byte b1, byte b2)

Writes the given two-byte tag directly to the stream.

public static void WriteRawTag(ref Span buffer, ref WriterInternalState state, byte b1, byte b2, byte b3)

Writes the given three-byte tag directly to the stream.

public static void WriteRawTag(ref Span buffer, ref WriterInternalState state, byte b1, byte b2, byte b3, byte b4)

Writes the given four-byte tag directly to the stream.

public static void WriteRawTag(ref Span buffer, ref WriterInternalState state, byte b1, byte b2, byte b3, byte b4, byte b5)

Writes the given five-byte tag directly to the stream.

public static void WriteRawVarint32(ref Span buffer, ref WriterInternalState state, uint value)

Writes a 32 bit value as a varint. The fast route is taken when there's enough buffer space left to whizz through without checking for each byte; otherwise, we resort to calling WriteRawByte each time.

public static void WriteRawVarint64(ref Span buffer, ref WriterInternalState state, ulong value)

public static void WriteSFixed32(ref Span buffer, ref WriterInternalState state, int value)

Writes an sfixed32 value, without a tag, to the stream.

public static void WriteSFixed64(ref Span buffer, ref WriterInternalState state, long value)

Writes an sfixed64 value, without a tag, to the stream.

public static void WriteSInt32(ref Span buffer, ref WriterInternalState state, int value)

Writes an sint32 value, without a tag, to the stream.

public static void WriteSInt64(ref Span buffer, ref WriterInternalState state, long value)

Writes an sint64 value, without a tag, to the stream.

public static void WriteString(ref Span buffer, ref WriterInternalState state, string value)

Writes a string field value, without a tag, to the stream. The data is length-prefixed.

public static void WriteTag(ref Span buffer, ref WriterInternalState state, int fieldNumber, WireType type)

Encodes and writes a tag.

public static void WriteTag(ref Span buffer, ref WriterInternalState state, uint tag)

Writes an already-encoded tag.

public static void WriteUInt32(ref Span buffer, ref WriterInternalState state, uint value)

Writes a uint32 value, without a tag, to the stream.

public static void WriteUInt64(ref Span buffer, ref WriterInternalState state, ulong value)

Writes a uint64 field value, without a tag, to the stream.