/// <summary> /// Writes a fixed64 field value, without a tag. /// </summary> /// <param name="value">The value to write</param> public void WriteFixed64(ulong value) { WritingPrimitives.WriteFixed64(ref buffer, ref state, value); }
/// <summary> /// Writes out part of an array of bytes. /// </summary> internal void WriteRawBytes(byte[] value, int offset, int length) { var span = new Span <byte>(buffer); WritingPrimitives.WriteRawBytes(ref span, ref state, value, offset, length); }
/// <summary> /// Computes the number of bytes that would be needed to encode an /// sint32 field, including the tag. /// </summary> public static int ComputeSInt32Size(int value) { return(ComputeRawVarint32Size(WritingPrimitives.EncodeZigZag32(value))); }
/// <summary> /// Writes the given single-byte tag directly to the stream. /// </summary> /// <param name="b1">The encoded tag</param> public void WriteRawTag(byte b1) { var span = new Span <byte>(buffer); WritingPrimitives.WriteRawTag(ref span, ref state, b1); }
/// <summary> /// 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. /// </summary> internal void WriteRawVarint32(uint value) { var span = new Span <byte>(buffer); WritingPrimitives.WriteRawVarint32(ref span, ref state, value); }
/// <summary> /// Writes an sint64 value, without a tag, to the stream. /// </summary> /// <param name="value">The value to write</param> public void WriteSInt64(long value) { var span = new Span <byte>(buffer); WritingPrimitives.WriteSInt64(ref span, ref state, value); }
/// <summary> /// Encodes and writes a tag. /// </summary> /// <param name="fieldNumber">The number of the field to write the tag for</param> /// <param name="type">The wire format type of the tag to write</param> public void WriteTag(int fieldNumber, WireFormat.WireType type) { var span = new Span <byte>(buffer); WritingPrimitives.WriteTag(ref span, ref state, fieldNumber, type); }
/// <summary> /// Writes an sint64 value, without a tag. /// </summary> /// <param name="value">The value to write</param> public void WriteSInt64(long value) { WritingPrimitives.WriteSInt64(ref buffer, ref state, value); }
/// <summary> /// Writes a length (in bytes) for length-delimited data. /// </summary> /// <remarks> /// This method simply writes a rawint, but exists for clarity in calling code. /// </remarks> /// <param name="length">Length value, in bytes.</param> public void WriteLength(int length) { WritingPrimitives.WriteLength(ref buffer, ref state, length); }
/// <summary> /// Writes an enum value, without a tag. /// </summary> /// <param name="value">The value to write</param> public void WriteEnum(int value) { WritingPrimitives.WriteEnum(ref buffer, ref state, value); }
/// <summary> /// Writes an sint32 value, without a tag. /// </summary> /// <param name="value">The value to write</param> public void WriteSInt32(int value) { WritingPrimitives.WriteSInt32(ref buffer, ref state, value); }
/// <summary> /// Write a byte string, without a tag, to the stream. /// The data is length-prefixed. /// </summary> /// <param name="value">The value to write</param> public void WriteBytes(ByteString value) { WritingPrimitives.WriteBytes(ref buffer, ref state, value); }
/// <summary> /// Writes a bool field value, without a tag. /// </summary> /// <param name="value">The value to write</param> public void WriteBool(bool value) { WritingPrimitives.WriteBool(ref buffer, ref state, value); }
/// <summary> /// Writes a fixed32 field value, without a tag. /// </summary> /// <param name="value">The value to write</param> public void WriteFixed32(uint value) { WritingPrimitives.WriteFixed32(ref buffer, ref state, value); }
/// <summary> /// Write a byte string, without a tag, to the stream. /// The data is length-prefixed. /// </summary> /// <param name="value">The value to write</param> public void WriteBytes(ByteString value) { var span = new Span <byte>(buffer); WritingPrimitives.WriteBytes(ref span, ref state, value); }
/// <summary> /// Encodes and writes a tag. /// </summary> /// <param name="fieldNumber">The number of the field to write the tag for</param> /// <param name="type">The wire format type of the tag to write</param> public void WriteTag(int fieldNumber, WireFormat.WireType type) { WritingPrimitives.WriteTag(ref buffer, ref state, fieldNumber, type); }
/// <summary> /// Writes an sfixed32 value, without a tag, to the stream. /// </summary> /// <param name="value">The value to write.</param> public void WriteSFixed32(int value) { var span = new Span <byte>(buffer); WritingPrimitives.WriteSFixed32(ref span, ref state, value); }
/// <summary> /// Writes an already-encoded tag. /// </summary> /// <param name="tag">The encoded tag</param> public void WriteTag(uint tag) { WritingPrimitives.WriteTag(ref buffer, ref state, tag); }
/// <summary> /// Writes a length (in bytes) for length-delimited data. /// </summary> /// <remarks> /// This method simply writes a rawint, but exists for clarity in calling code. /// </remarks> /// <param name="length">Length value, in bytes.</param> public void WriteLength(int length) { var span = new Span <byte>(buffer); WritingPrimitives.WriteLength(ref span, ref state, length); }
/// <summary> /// Writes the given two-byte tag. /// </summary> /// <param name="b1">The first byte of the encoded tag</param> /// <param name="b2">The second byte of the encoded tag</param> public void WriteRawTag(byte b1, byte b2) { WritingPrimitives.WriteRawTag(ref buffer, ref state, b1, b2); }
/// <summary> /// Writes an already-encoded tag. /// </summary> /// <param name="tag">The encoded tag</param> public void WriteTag(uint tag) { var span = new Span <byte>(buffer); WritingPrimitives.WriteTag(ref span, ref state, tag); }
/// <summary> /// Writes the given five-byte tag. /// </summary> /// <param name="b1">The first byte of the encoded tag</param> /// <param name="b2">The second byte of the encoded tag</param> /// <param name="b3">The third byte of the encoded tag</param> /// <param name="b4">The fourth byte of the encoded tag</param> /// <param name="b5">The fifth byte of the encoded tag</param> public void WriteRawTag(byte b1, byte b2, byte b3, byte b4, byte b5) { WritingPrimitives.WriteRawTag(ref buffer, ref state, b1, b2, b3, b4, b5); }
/// <summary> /// Writes the given five-byte tag directly to the stream. /// </summary> /// <param name="b1">The first byte of the encoded tag</param> /// <param name="b2">The second byte of the encoded tag</param> /// <param name="b3">The third byte of the encoded tag</param> /// <param name="b4">The fourth byte of the encoded tag</param> /// <param name="b5">The fifth byte of the encoded tag</param> public void WriteRawTag(byte b1, byte b2, byte b3, byte b4, byte b5) { var span = new Span <byte>(buffer); WritingPrimitives.WriteRawTag(ref span, ref state, b1, b2, b3, b4, b5); }
/// <summary> /// Writes a double field value, without a tag, to the stream. /// </summary> /// <param name="value">The value to write</param> public void WriteDouble(double value) { var span = new Span <byte>(buffer); WritingPrimitives.WriteDouble(ref span, ref state, value); }
internal void WriteRawLittleEndian64(ulong value) { var span = new Span <byte>(buffer); WritingPrimitives.WriteRawLittleEndian64(ref span, ref state, value); }
/// <summary> /// Writes a float field value, without a tag, to the stream. /// </summary> /// <param name="value">The value to write</param> public void WriteFloat(float value) { var span = new Span <byte>(buffer); WritingPrimitives.WriteFloat(ref span, ref state, value); }
public static void WriteMessage(ref WriteContext ctx, IMessage value) { WritingPrimitives.WriteLength(ref ctx.buffer, ref ctx.state, value.CalculateSize()); WriteRawMessage(ref ctx, value); }
/// <summary> /// Writes a bool field value, without a tag, to the stream. /// </summary> /// <param name="value">The value to write</param> public void WriteBool(bool value) { var span = new Span <byte>(buffer); WritingPrimitives.WriteBool(ref span, ref state, value); }
/// <summary> /// Computes the number of bytes that would be needed to encode an /// sint64 field, including the tag. /// </summary> public static int ComputeSInt64Size(long value) { return(ComputeRawVarint64Size(WritingPrimitives.EncodeZigZag64(value))); }
/// <summary> /// Writes a float field value, without a tag. /// </summary> /// <param name="value">The value to write</param> public void WriteFloat(float value) { WritingPrimitives.WriteFloat(ref buffer, ref state, value); }