Google.Protobuf.ParsingPrimitives
Primitives for parsing protobuf wire format.
Decode a 32-bit value with ZigZag encoding.
Decode a 64-bit value with ZigZag encoding.
Checks whether there is known data available of the specified size remaining to parse.
When parsing from a Stream this can return false because we have no knowledge of the amount
of data remaining in the stream until it is read.
public static bool MaybeConsumeTag(ref ReadOnlySpan buffer, ref ParserInternalState state, uint tag)
Peeks at the next tag in the stream. If it matches tag,
the tag is consumed and the method returns true; otherwise, the
stream is left in the original position and the method returns false.
Parses a double value.
Parses a float value.
Reads a length for length-delimited data.
Parses a 32-bit little-endian integer.
Parses a 64-bit little-endian integer.
Parses a raw Varint. If larger than 32 bits, discard the upper bits.
This method is optimised for the case where we've got lots of data in the buffer.
That means we can check the size just once, then just read directly from the buffer
without constant rechecking of the buffer length.
Parses a raw varint.
Parses the next tag.
If the end of logical stream was reached, an invalid tag of 0 is returned.
Peeks at the next field tag. This is like calling ParseTag, but the
tag is not consumed. (So a subsequent call to ParseTag will return the
same value.)
Reads a bytes field value from the input.
Reads a fixed size of bytes from the input.
public static string ReadRawString(ref ReadOnlySpan buffer, ref ParserInternalState state, int length)
Reads a UTF-8 string from the next "length" bytes.
Reads a varint from the input one byte at a time, so that it does not
read any bytes after the end of the varint. If you simply wrapped the
stream in a CodedInputStream and used ReadRawVarint32(Stream)
then you would probably end up reading past the end of the varint since
CodedInputStream buffers its input.
Reads a string field value from the input.
Reads and discards size bytes.