Google.Protobuf Provides a utility routine to copy small arrays much more quickly than Buffer.BlockCopy The threshold above which you should use Buffer.BlockCopy rather than ByteArray.Copy Determines which copy routine to use based on the number of bytes to be copied. Reverses the order of bytes in the array Immutable array of bytes. Internal use only. Ensure that the provided memory is not mutated and belongs to this instance. Internal use only. Ensure that the provided memory is not mutated and belongs to this instance. This method encapsulates converting array to memory. Reduces need for SecuritySafeCritical in .NET Framework. Constructs a new ByteString from the given memory. The memory is *not* copied, and must not be modified after this constructor is called. Returns an empty ByteString. Returns the length of this ByteString in bytes. Returns true if this byte string is empty, false otherwise. Provides read-only access to the data of this . No data is copied so this is the most efficient way of accessing. Provides read-only access to the data of this . No data is copied so this is the most efficient way of accessing. Converts this into a byte array. The data is copied - changes to the returned array will not be reflected in this ByteString. A byte array with the same data as this ByteString. Converts this into a standard base64 representation. A base64 representation of this ByteString. Constructs a from the Base64 Encoded String. Constructs a from data in the given stream, synchronously. If successful, will be read completely, from the position at the start of the call. The stream to copy into a ByteString. A ByteString with content read from the given stream. Constructs a from data in the given stream, asynchronously. If successful, will be read completely, from the position at the start of the call. The stream to copy into a ByteString. The cancellation token to use when reading from the stream, if any. A ByteString with content read from the given stream. Constructs a from the given array. The contents are copied, so further modifications to the array will not be reflected in the returned ByteString. This method can also be invoked in ByteString.CopyFrom(0xaa, 0xbb, ...) form which is primarily useful for testing. Constructs a from a portion of a byte array. Constructs a from a read only span. The contents are copied, so further modifications to the span will not be reflected in the returned . Creates a new by encoding the specified text with the given encoding. Creates a new by encoding the specified text in UTF-8. Returns the byte at the given index. Converts this into a string by applying the given encoding. This method should only be used to convert binary data which was the result of encoding text with the given encoding. The encoding to use to decode the binary data into text. The result of decoding the binary data with the given decoding. Converts this into a string by applying the UTF-8 encoding. This method should only be used to convert binary data which was the result of encoding text with UTF-8. The result of decoding the binary data with the given decoding. Returns an iterator over the bytes in this . An iterator over the bytes in this object. Returns an iterator over the bytes in this . An iterator over the bytes in this object. Creates a CodedInputStream from this ByteString's data. Compares two byte strings for equality. The first byte string to compare. The second byte string to compare. true if the byte strings are equal; false otherwise. Compares two byte strings for inequality. The first byte string to compare. The second byte string to compare. false if the byte strings are equal; true otherwise. Compares this byte string with another object. The object to compare this with. true if refers to an equal ; false otherwise. Returns a hash code for this object. Two equal byte strings will return the same hash code. A hash code for this object. Compares this byte string with another. The to compare this with. true if refers to an equal byte string; false otherwise. Copies the entire byte array to the destination array provided at the offset specified. Writes the entire byte array to the provided stream SecuritySafeCritical attribute can not be placed on types with async methods. This class has ByteString's async methods so it can be marked with SecuritySafeCritical. Reads and decodes protocol message fields. This class is generally used by generated code to read appropriate primitives from the stream. It effectively encapsulates the lowest levels of protocol buffer format. Repeated fields and map fields are not handled by this class; use and to serialize such fields. Whether to leave the underlying stream open when disposing of this stream. This is always true when there's no stream. Buffer of data read from the stream or provided at construction time. The stream to read further input from, or null if the byte array buffer was provided directly on construction, with no further data available. The parser state is kept separately so that other parse implementations can reuse the same parsing primitives. Creates a new CodedInputStream reading data from the given byte array. Creates a new that reads from the given byte array slice. Creates a new reading data from the given stream, which will be disposed when the returned object is disposed. The stream to read from. Creates a new reading data from the given stream. The stream to read from. true to leave open when the returned is disposed; false to dispose of the given stream when the returned object is disposed. Creates a new CodedInputStream reading data from the given stream and buffer, using the default limits. Creates a new CodedInputStream reading data from the given stream and buffer, using the specified limits. This chains to the version with the default limits instead of vice versa to avoid having to check that the default values are valid every time. Creates a with the specified size and recursion limits, reading from an input stream. This method exists separately from the constructor to reduce the number of constructor overloads. It is likely to be used considerably less frequently than the constructors, as the default limits are suitable for most use cases. The input stream to read from The total limit of data to read from the stream. The maximum recursion depth to allow while reading. A CodedInputStream reading from with the specified size and recursion limits. Returns the current position in the input stream, or the position in the input buffer Returns the last tag read, or 0 if no tags have been read or we've read beyond the end of the stream. Returns the size limit for this stream. This limit is applied when reading from the underlying stream, as a sanity check. It is not applied when reading from a byte array data source without an underlying stream. The default value is Int32.MaxValue. The size limit. Returns the recursion limit for this stream. This limit is applied whilst reading messages, to avoid maliciously-recursive data. The default limit is 100. The recursion limit for this stream. Internal-only property; when set to true, unknown fields will be discarded while parsing. Internal-only property; provides extension identifiers to compatible messages while parsing. Disposes of this instance, potentially closing any underlying stream. As there is no flushing to perform here, disposing of a which was constructed with the leaveOpen option parameter set to true (or one which was constructed to read from a byte array) has no effect. Verifies that the last call to ReadTag() returned tag 0 - in other words, we've reached the end of the stream when we expected to. The tag read was not the one specified Peeks at the next field tag. This is like calling , but the tag is not consumed. (So a subsequent call to will return the same value.) Reads a field tag, returning the tag of 0 for "end of stream". If this method returns 0, it doesn't necessarily mean the end of all the data in this CodedInputStream; it may be the end of the logical stream for an embedded message, for example. The next field tag, or 0 for end of stream. (0 is never a valid tag.) Skips the data for the field with the tag we've just read. This should be called directly after , when the caller wishes to skip an unknown field. This method throws if the last-read tag was an end-group tag. If a caller wishes to skip a group, they should skip the whole group, by calling this method after reading the start-group tag. This behavior allows callers to call this method on any field they don't understand, correctly resulting in an error if an end-group tag has not been paired with an earlier start-group tag. The last tag was an end-group tag The last read operation read to the end of the logical stream Skip a group. Reads a double field from the stream. Reads a float field from the stream. Reads a uint64 field from the stream. Reads an int64 field from the stream. Reads an int32 field from the stream. Reads a fixed64 field from the stream. Reads a fixed32 field from the stream. Reads a bool field from the stream. Reads a string field from the stream. Reads an embedded message field value from the stream. Reads an embedded group field from the stream. Reads a bytes field value from the stream. Reads a uint32 field value from the stream. Reads an enum field value from the stream. Reads an sfixed32 field value from the stream. Reads an sfixed64 field value from the stream. Reads an sint32 field value from the stream. Reads an sint64 field value from the stream. Reads a length for length-delimited data. This is internally just reading a varint, but this method exists to make the calling code clearer. Peeks at the next tag in the stream. If it matches , the tag is consumed and the method returns true; otherwise, the stream is left in the original position and the method returns false. Reads a raw Varint from the stream. 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. 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 raw varint from the stream. Reads a 32-bit little-endian integer from the stream. Reads a 64-bit little-endian integer from the stream. Sets currentLimit to (current position) + byteLimit. This is called when descending into a length-delimited embedded message. The previous limit is returned. The old limit. Discards the current limit, returning the previous limit. Returns whether or not all the data before the limit has been read. Returns true if the stream has reached the end of the input. This is the case if either the end of the underlying input source has been reached or the stream has reached a limit created using PushLimit. Reads a fixed size of bytes from the input. the end of the stream or the current limit was reached Reads a top-level message or a nested message after the limits for this message have been pushed. (parser will proceed until the end of the current limit) NOTE: this method needs to be public because it's invoked by the generated code - e.g. msg.MergeFrom(CodedInputStream input) method Encodes and writes protocol message fields. This class is generally used by generated code to write appropriate primitives to the stream. It effectively encapsulates the lowest levels of protocol buffer format. Unlike some other implementations, this does not include combined "write tag and value" methods. Generated code knows the exact byte representations of the tags they're going to write, so there's no need to re-encode them each time. Manually-written code calling this class should just call one of the WriteTag overloads before each value. Repeated fields and map fields are not handled by this class; use RepeatedField<T> and MapField<TKey, TValue> to serialize such fields. Computes the number of bytes that would be needed to encode a double field, including the tag. Computes the number of bytes that would be needed to encode a float field, including the tag. Computes the number of bytes that would be needed to encode a uint64 field, including the tag. Computes the number of bytes that would be needed to encode an int64 field, including the tag. Computes the number of bytes that would be needed to encode an int32 field, including the tag. Computes the number of bytes that would be needed to encode a fixed64 field, including the tag. Computes the number of bytes that would be needed to encode a fixed32 field, including the tag. Computes the number of bytes that would be needed to encode a bool field, including the tag. Computes the number of bytes that would be needed to encode a string field, including the tag. Computes the number of bytes that would be needed to encode a group field, including the tag. Computes the number of bytes that would be needed to encode an embedded message field, including the tag. Computes the number of bytes that would be needed to encode a bytes field, including the tag. Computes the number of bytes that would be needed to encode a uint32 field, including the tag. Computes the number of bytes that would be needed to encode a enum field, including the tag. The caller is responsible for converting the enum value to its numeric value. Computes the number of bytes that would be needed to encode an sfixed32 field, including the tag. Computes the number of bytes that would be needed to encode an sfixed64 field, including the tag. Computes the number of bytes that would be needed to encode an sint32 field, including the tag. Computes the number of bytes that would be needed to encode an sint64 field, including the tag. Computes the number of bytes that would be needed to encode a length, as written by . Computes the number of bytes that would be needed to encode a varint. Computes the number of bytes that would be needed to encode a varint. Computes the number of bytes that would be needed to encode a tag. The buffer size used by CreateInstance(Stream). Creates a new CodedOutputStream that writes directly to the given byte array. If more bytes are written than fit in the array, OutOfSpaceException will be thrown. Creates a new CodedOutputStream that writes directly to the given byte array slice. If more bytes are written than fit in the array, OutOfSpaceException will be thrown. Creates a new which write to the given stream, and disposes of that stream when the returned CodedOutputStream is disposed. The stream to write to. It will be disposed when the returned CodedOutputStream is disposed. Creates a new CodedOutputStream which write to the given stream and uses the specified buffer size. The stream to write to. It will be disposed when the returned CodedOutputStream is disposed. The size of buffer to use internally. Creates a new CodedOutputStream which write to the given stream. The stream to write to. If true, is left open when the returned CodedOutputStream is disposed; if false, the provided stream is disposed as well. Creates a new CodedOutputStream which write to the given stream and uses the specified buffer size. The stream to write to. The size of buffer to use internally. If true, is left open when the returned CodedOutputStream is disposed; if false, the provided stream is disposed as well. Returns the current position in the stream, or the position in the output buffer Writes a double field value, without a tag, to the stream. The value to write Writes a float field value, without a tag, to the stream. The value to write Writes a uint64 field value, without a tag, to the stream. The value to write Writes an int64 field value, without a tag, to the stream. The value to write Writes an int32 field value, without a tag, to the stream. The value to write Writes a fixed64 field value, without a tag, to the stream. The value to write Writes a fixed32 field value, without a tag, to the stream. The value to write Writes a bool field value, without a tag, to the stream. The value to write Writes a string field value, without a tag, to the stream. The data is length-prefixed. The value to write Writes a message, without a tag, to the stream. The data is length-prefixed. The value to write Writes a message, without a tag, to the stream. Only the message data is written, without a length-delimiter. The value to write Writes a group, without a tag, to the stream. The value to write Write a byte string, without a tag, to the stream. The data is length-prefixed. The value to write Writes a uint32 value, without a tag, to the stream. The value to write Writes an enum value, without a tag, to the stream. The value to write Writes an sfixed32 value, without a tag, to the stream. The value to write. Writes an sfixed64 value, without a tag, to the stream. The value to write Writes an sint32 value, without a tag, to the stream. The value to write Writes an sint64 value, without a tag, to the stream. The value to write Writes a length (in bytes) for length-delimited data. This method simply writes a rawint, but exists for clarity in calling code. Length value, in bytes. Encodes and writes a tag. The number of the field to write the tag for The wire format type of the tag to write Writes an already-encoded tag. The encoded tag Writes the given single-byte tag directly to the stream. The encoded tag Writes the given two-byte tag directly to the stream. The first byte of the encoded tag The second byte of the encoded tag Writes the given three-byte tag directly to the stream. The first byte of the encoded tag The second byte of the encoded tag The third byte of the encoded tag Writes the given four-byte tag directly to the stream. The first byte of the encoded tag The second byte of the encoded tag The third byte of the encoded tag The fourth byte of the encoded tag Writes the given five-byte tag directly to the stream. The first byte of the encoded tag The second byte of the encoded tag The third byte of the encoded tag The fourth byte of the encoded tag The fifth byte of the encoded tag 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. Writes out an array of bytes. Writes out part of an array of bytes. Indicates that a CodedOutputStream wrapping a flat byte array ran out of space. Flushes any buffered data and optionally closes the underlying stream, if any. By default, any underlying stream is closed by this method. To configure this behaviour, use a constructor overload with a leaveOpen parameter. If this instance does not have an underlying stream, this method does nothing. For the sake of efficiency, calling this method does not prevent future write calls - but if a later write ends up writing to a stream which has been disposed, that is likely to fail. It is recommend that you not call any other methods after this. Flushes any buffered data to the underlying stream (if there is one). Verifies that SpaceLeft returns zero. It's common to create a byte array that is exactly big enough to hold a message, then write to it with a CodedOutputStream. Calling CheckNoSpaceLeft after writing verifies that the message was actually as big as expected, which can help finding bugs. If writing to a flat array, returns the space left in the array. Otherwise, throws an InvalidOperationException. Utility to compare if two Lists are the same, and the hash code of a List. Checks if two lists are equal. Gets the list's hash code. Representation of a map field in a Protocol Buffer message. Key type in the map. Must be a type supported by Protocol Buffer map keys. Value type in the map. Must be a type supported by Protocol Buffers. For string keys, the equality comparison is provided by . Null values are not permitted in the map, either for wrapper types or regular messages. If a map is deserialized from a data stream and the value is missing from an entry, a default value is created instead. For primitive types, that is the regular default value (0, the empty string and so on); for message types, an empty instance of the message is created, as if the map entry contained a 0-length encoded value for the field. This implementation does not generally prohibit the use of key/value types which are not supported by Protocol Buffers (e.g. using a key type of byte) but nor does it guarantee that all operations will work in such cases. The order in which entries are returned when iterating over this object is undefined, and may change in future versions. Creates a deep clone of this object. A deep clone of this object. Adds the specified key/value pair to the map. This operation fails if the key already exists in the map. To replace an existing entry, use the indexer. The key to add The value to add. The given key already exists in map. Determines whether the specified key is present in the map. The key to check. true if the map contains the given key; false otherwise. Removes the entry identified by the given key from the map. The key indicating the entry to remove from the map. true if the map contained the given key before the entry was removed; false otherwise. Gets the value associated with the specified key. The key whose value to get. When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the parameter. This parameter is passed uninitialized. true if the map contains an element with the specified key; otherwise, false. Gets or sets the value associated with the specified key. The key of the value to get or set. The property is retrieved and key does not exist in the collection. The value associated with the specified key. If the specified key is not found, a get operation throws a , and a set operation creates a new element with the specified key. Gets a collection containing the keys in the map. Gets a collection containing the values in the map. Adds the specified entries to the map. The keys and values are not automatically cloned. The entries to add to the map. Adds the specified entries to the map, replacing any existing entries with the same keys. The keys and values are not automatically cloned. This method primarily exists to be called from MergeFrom methods in generated classes for messages. The entries to add to the map. Returns an enumerator that iterates through the collection. An enumerator that can be used to iterate through the collection. Returns an enumerator that iterates through a collection. An object that can be used to iterate through the collection. Adds the specified item to the map. The item to add to the map. Removes all items from the map. Determines whether map contains an entry equivalent to the given key/value pair. The key/value pair to find. Copies the key/value pairs in this map to an array. The array to copy the entries into. The index of the array at which to start copying values. Removes the specified key/value pair from the map. Both the key and the value must be found for the entry to be removed. The key/value pair to remove. true if the key/value pair was found and removed; false otherwise. Gets the number of elements contained in the map. Gets a value indicating whether the map is read-only. Determines whether the specified , is equal to this instance. The to compare with this instance. true if the specified is equal to this instance; otherwise, false. Returns a hash code for this instance. A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. Compares this map with another for equality. The order of the key/value pairs in the maps is not deemed significant in this comparison. The map to compare this with. true if refers to an equal map; false otherwise. Adds entries to the map from the given stream. It is assumed that the stream is initially positioned after the tag specified by the codec. This method will continue reading entries from the stream until the end is reached, or a different tag is encountered. Stream to read from Codec describing how the key/value pairs are encoded Adds entries to the map from the given parse context. It is assumed that the input is initially positioned after the tag specified by the codec. This method will continue reading entries from the input until the end is reached, or a different tag is encountered. Input to read from Codec describing how the key/value pairs are encoded Writes the contents of this map to the given coded output stream, using the specified codec to encode each entry. The output stream to write to. The codec to use for each entry. Writes the contents of this map to the given write context, using the specified codec to encode each entry. The write context to write to. The codec to use for each entry. Calculates the size of this map based on the given entry codec. The codec to use to encode each entry. Returns a string representation of this repeated field, in the same way as it would be represented by the default JSON formatter. A codec for a specific map field. This contains all the information required to encode and decode the nested messages. Creates a new entry codec based on a separate key codec and value codec, and the tag to use for each map entry. The key codec. The value codec. The map tag to use to introduce each map entry. The key codec. The value codec. The tag used in the enclosing message to indicate map entries. Provides a central place to implement equality comparisons, primarily for bitwise float/double equality. Returns an equality comparer for suitable for Protobuf equality comparisons. This is usually just the default equality comparer for the type, but floating point numbers are compared bitwise. The type of equality comparer to return. The equality comparer. Returns an equality comparer suitable for comparing 64-bit floating point values, by bitwise comparison. (NaN values are considered equal, but only when they have the same representation.) Returns an equality comparer suitable for comparing 32-bit floating point values, by bitwise comparison. (NaN values are considered equal, but only when they have the same representation.) Returns an equality comparer suitable for comparing nullable 64-bit floating point values, by bitwise comparison. (NaN values are considered equal, but only when they have the same representation.) Returns an equality comparer suitable for comparing nullable 32-bit floating point values, by bitwise comparison. (NaN values are considered equal, but only when they have the same representation.) The contents of a repeated field: essentially, a collection with some extra restrictions (no null values) and capabilities (deep cloning). This implementation does not generally prohibit the use of types which are not supported by Protocol Buffers but nor does it guarantee that all operations will work in such cases. The element type of the repeated field. Creates a deep clone of this repeated field. If the field type is a message type, each element is also cloned; otherwise, it is assumed that the field type is primitive (including string and bytes, both of which are immutable) and so a simple copy is equivalent to a deep clone. A deep clone of this repeated field. Adds the entries from the given input stream, decoding them with the specified codec. The input stream to read from. The codec to use in order to read each entry. Adds the entries from the given parse context, decoding them with the specified codec. The input to read from. The codec to use in order to read each entry. Calculates the size of this collection based on the given codec. The codec to use when encoding each field. The number of bytes that would be written to an output by one of the WriteTo methods, using the same codec. Writes the contents of this collection to the given , encoding each value using the specified codec. The output stream to write to. The codec to use when encoding each value. Writes the contents of this collection to the given write context, encoding each value using the specified codec. The write context to write to. The codec to use when encoding each value. Gets and sets the capacity of the RepeatedField's internal array. When set, the internal array is reallocated to the given capacity. The new value is less than . Adds the specified item to the collection. The item to add. Removes all items from the collection. Determines whether this collection contains the given item. The item to find. true if this collection contains the given item; false otherwise. Copies this collection to the given array. The array to copy to. The first index of the array to copy to. Removes the specified item from the collection The item to remove. true if the item was found and removed; false otherwise. Gets the number of elements contained in the collection. Gets a value indicating whether the collection is read-only. Adds all of the specified values into this collection. The values to add to this collection. Adds all of the specified values into this collection. This method is present to allow repeated fields to be constructed from queries within collection initializers. Within non-collection-initializer code, consider using the equivalent method instead for clarity. The values to add to this collection. Returns an enumerator that iterates through the collection. An enumerator that can be used to iterate through the collection. Determines whether the specified , is equal to this instance. The to compare with this instance. true if the specified is equal to this instance; otherwise, false. Returns an enumerator that iterates through a collection. An object that can be used to iterate through the collection. Returns a hash code for this instance. A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. Compares this repeated field with another for equality. The repeated field to compare this with. true if refers to an equal repeated field; false otherwise. Returns the index of the given item within the collection, or -1 if the item is not present. The item to find in the collection. The zero-based index of the item, or -1 if it is not found. Inserts the given item at the specified index. The index at which to insert the item. The item to insert. Removes the item at the given index. The zero-based index of the item to remove. Returns a string representation of this repeated field, in the same way as it would be represented by the default JSON formatter. Gets or sets the item at the specified index. The element at the specified index. The zero-based index of the element to get or set. The item at the specified index. Extension methods for , effectively providing the familiar members from previous desktop framework versions while targeting the newer releases, .NET Core etc. Returns the public getter of a property, or null if there is no such getter (either because it's read-only, or the getter isn't public). Returns the public setter of a property, or null if there is no such setter (either because it's write-only, or the setter isn't public). Provides extension methods on Type that just proxy to TypeInfo. These are used to support the new type system from .NET 4.5, without having calls to GetTypeInfo all over the place. While the methods here are meant to be broadly compatible with the desktop framework, there are some subtle differences in behaviour - but they're not expected to affect our use cases. While the class is internal, that should be fine: we can evaluate each new use appropriately. See https://msdn.microsoft.com/en-us/library/system.type.isassignablefrom Returns a representation of the public property associated with the given name in the given type, including inherited properties or null if there is no such public property. Here, "public property" means a property where either the getter, or the setter, or both, is public. Returns a representation of the public method associated with the given name in the given type, including inherited methods. This has a few differences compared with Type.GetMethod in the desktop framework. It will throw if there is an ambiguous match even between a private method and a public one, but it *won't* throw if there are two overloads at different levels in the type hierarchy (e.g. class Base declares public void Foo(int) and class Child : Base declares public void Foo(long)). One type in the hierarchy declared more than one method with the same name Holder for reflection information generated from google/protobuf/compiler/plugin.proto File descriptor for google/protobuf/compiler/plugin.proto The version number of protocol compiler. Field number for the "major" field. Gets whether the "major" field is set Clears the value of the "major" field Field number for the "minor" field. Gets whether the "minor" field is set Clears the value of the "minor" field Field number for the "patch" field. Gets whether the "patch" field is set Clears the value of the "patch" field Field number for the "suffix" field. A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should be empty for mainline stable releases. Gets whether the "suffix" field is set Clears the value of the "suffix" field An encoded CodeGeneratorRequest is written to the plugin's stdin. Field number for the "file_to_generate" field. The .proto files that were explicitly listed on the command-line. The code generator should generate code only for these files. Each file's descriptor will be included in proto_file, below. Field number for the "parameter" field. The generator parameter passed on the command-line. Gets whether the "parameter" field is set Clears the value of the "parameter" field Field number for the "proto_file" field. FileDescriptorProtos for all files in files_to_generate and everything they import. The files will appear in topological order, so each file appears before any file that imports it. protoc guarantees that all proto_files will be written after the fields above, even though this is not technically guaranteed by the protobuf wire format. This theoretically could allow a plugin to stream in the FileDescriptorProtos and handle them one by one rather than read the entire set into memory at once. However, as of this writing, this is not similarly optimized on protoc's end -- it will store all fields in memory at once before sending them to the plugin. Type names of fields and extensions in the FileDescriptorProto are always fully qualified. Field number for the "compiler_version" field. The version number of protocol compiler. The plugin writes an encoded CodeGeneratorResponse to stdout. Field number for the "error" field. Error message. If non-empty, code generation failed. The plugin process should exit with status code zero even if it reports an error in this way. This should be used to indicate errors in .proto files which prevent the code generator from generating correct code. Errors which indicate a problem in protoc itself -- such as the input CodeGeneratorRequest being unparseable -- should be reported by writing a message to stderr and exiting with a non-zero status code. Gets whether the "error" field is set Clears the value of the "error" field Field number for the "supported_features" field. A bitmask of supported features that the code generator supports. This is a bitwise "or" of values from the Feature enum. Gets whether the "supported_features" field is set Clears the value of the "supported_features" field Field number for the "file" field. Container for nested types declared in the CodeGeneratorResponse message type. Sync with code_generator.h. Represents a single generated file. Field number for the "name" field. The file name, relative to the output directory. The name must not contain "." or ".." components and must be relative, not be absolute (so, the file cannot lie outside the output directory). "/" must be used as the path separator, not "\". If the name is omitted, the content will be appended to the previous file. This allows the generator to break large files into small chunks, and allows the generated text to be streamed back to protoc so that large files need not reside completely in memory at one time. Note that as of this writing protoc does not optimize for this -- it will read the entire CodeGeneratorResponse before writing files to disk. Gets whether the "name" field is set Clears the value of the "name" field Field number for the "insertion_point" field. If non-empty, indicates that the named file should already exist, and the content here is to be inserted into that file at a defined insertion point. This feature allows a code generator to extend the output produced by another code generator. The original generator may provide insertion points by placing special annotations in the file that look like: @@protoc_insertion_point(NAME) The annotation can have arbitrary text before and after it on the line, which allows it to be placed in a comment. NAME should be replaced with an identifier naming the point -- this is what other generators will use as the insertion_point. Code inserted at this point will be placed immediately above the line containing the insertion point (thus multiple insertions to the same point will come out in the order they were added). The double-@ is intended to make it unlikely that the generated code could contain things that look like insertion points by accident. For example, the C++ code generator places the following line in the .pb.h files that it generates: // @@protoc_insertion_point(namespace_scope) This line appears within the scope of the file's package namespace, but outside of any particular class. Another plugin can then specify the insertion_point "namespace_scope" to generate additional classes or other declarations that should be placed in this scope. Note that if the line containing the insertion point begins with whitespace, the same whitespace will be added to every line of the inserted text. This is useful for languages like Python, where indentation matters. In these languages, the insertion point comment should be indented the same amount as any inserted code will need to be in order to work correctly in that context. The code generator that generates the initial file and the one which inserts into it must both run as part of a single invocation of protoc. Code generators are executed in the order in which they appear on the command line. If |insertion_point| is present, |name| must also be present. Gets whether the "insertion_point" field is set Clears the value of the "insertion_point" field Field number for the "content" field. The file contents. Gets whether the "content" field is set Clears the value of the "content" field Field number for the "generated_code_info" field. Information describing the file content being inserted. If an insertion point is used, this information will be appropriately offset and inserted into the code generation metadata for the generated files. Represents a non-generic extension definition. This API is experimental and subject to change. Internal use. Creates a new extension with the specified field number. Gets the field number of this extension Represents a type-safe extension identifier used for getting and setting single extension values in instances. This API is experimental and subject to change. The message type this field applies to The field value type of this extension Creates a new extension identifier with the specified field number and codec Represents a type-safe extension identifier used for getting repeated extension values in instances. This API is experimental and subject to change. The message type this field applies to The repeated field value type of this extension Creates a new repeated extension identifier with the specified field number and codec Provides extensions to messages while parsing. This API is experimental and subject to change. Creates a new empty extension registry Gets the total number of extensions in this extension registry Returns whether the registry is readonly Adds the specified extension to the registry Adds the specified extensions to the registry Clears the registry of all values Gets whether the extension registry contains the specified extension Copies the arrays in the registry set to the specified array at the specified index The array to copy to The array index to start at Returns an enumerator to enumerate through the items in the registry Returns an enumerator for the extensions in this registry Removes the specified extension from the set The extension true if the extension was removed, otherwise false Clones the registry into a new registry Methods for managing s with null checking. Most users will not use this class directly and its API is experimental and subject to change. Gets the value of the specified extension Gets the value of the specified repeated extension or null if it doesn't exist in this set Gets the value of the specified repeated extension, registering it if it doesn't exist Sets the value of the specified extension. This will make a new instance of ExtensionSet if the set is null. Gets whether the value of the specified extension is set Clears the value of the specified extension Clears the value of the specified extension Tries to merge a field from the coded input, returning true if the field was merged. If the set is null or the field was not otherwise merged, this returns false. Tries to merge a field from the coded input, returning true if the field was merged. If the set is null or the field was not otherwise merged, this returns false. Merges the second set into the first set, creating a new instance if first is null Clones the set into a new set. If the set is null, this returns null Used for keeping track of extensions in messages. methods route to this set. Most users will not need to use this class directly The message type that extensions in this set target Gets a hash code of the set Returns whether this set is equal to the other object Calculates the size of this extension set Writes the extension values in this set to the output stream Writes the extension values in this set to the write context Factory methods for . Retrieves a codec suitable for a string field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for a bytes field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for a bool field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for an int32 field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for an sint32 field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for a fixed32 field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for an sfixed32 field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for a uint32 field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for an int64 field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for an sint64 field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for a fixed64 field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for an sfixed64 field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for a uint64 field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for a float field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for a double field with the given tag. The tag. A codec for the given tag. Retrieves a codec suitable for an enum field with the given tag. The tag. A conversion function from to the enum type. A conversion function from the enum type to . A codec for the given tag. Retrieves a codec suitable for a string field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for a bytes field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for a bool field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for an int32 field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for an sint32 field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for a fixed32 field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for an sfixed32 field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for a uint32 field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for an int64 field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for an sint64 field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for a fixed64 field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for an sfixed64 field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for a uint64 field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for a float field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for a double field with the given tag. The tag. The default value. A codec for the given tag. Retrieves a codec suitable for an enum field with the given tag. The tag. A conversion function from to the enum type. A conversion function from the enum type to . The default value. A codec for the given tag. Retrieves a codec suitable for a message field with the given tag. The tag. A parser to use for the message type. A codec for the given tag. Retrieves a codec suitable for a group field with the given tag. The start group tag. The end group tag. A parser to use for the group message type. A codec for given tag Creates a codec for a wrapper type of a class - which must be string or ByteString. Creates a codec for a wrapper type of a struct - which must be Int32, Int64, UInt32, UInt64, Bool, Single or Double. Helper code to create codecs for wrapper types. Somewhat ugly with all the static methods, but the conversions involved to/from nullable types make it slightly tricky to improve. So long as we keep the public API (ForClassWrapper, ForStructWrapper) in place, we can refactor later if we come up with something cleaner. Returns a field codec which effectively wraps a value of type T in a message. An encode/decode pair for a single field. This effectively encapsulates all the information needed to read or write the field value from/to a coded stream. This class is public and has to be as it is used by generated code, but its public API is very limited - just what the generated code needs to call directly. This never writes default values to the stream, and does not address "packedness" in repeated fields itself, other than to know whether or not the field *should* be packed. Merges an input stream into a value Merges a value into a reference to another value, returning a boolean if the value was set Returns a delegate to write a value (unconditionally) to a coded output stream. Returns the size calculator for just a value. Returns a delegate to read a value from a coded input stream. It is assumed that the stream is already positioned on the appropriate tag. Returns a delegate to merge a value from a coded input stream. It is assumed that the stream is already positioned on the appropriate tag Returns a delegate to merge two values together. Returns the fixed size for an entry, or 0 if sizes vary. Gets the tag of the codec. The tag of the codec. Gets the end tag of the codec or 0 if there is no end tag The end tag of the codec. Default value for this codec. Usually the same for every instance of the same type, but for string/ByteString wrapper fields the codec's default value is null, whereas for other string/ByteString fields it's "" or ByteString.Empty. The default value of the codec's type. Write a tag and the given value, *if* the value is not the default. Write a tag and the given value, *if* the value is not the default. Reads a value of the codec type from the given . The input stream to read from. The value read from the stream. Reads a value of the codec type from the given . The parse context to read from. The value read. Calculates the size required to write the given value, with a tag, if the value is not the default. Calculates the size required to write the given value, with a tag, even if the value is the default. A tree representation of a FieldMask. Each leaf node in this tree represent a field path in the FieldMask. For example, FieldMask "foo.bar,foo.baz,bar.baz" as a tree will be: [root] -+- foo -+- bar | | | +- baz | +- bar --- baz By representing FieldMasks with this tree structure we can easily convert a FieldMask to a canonical form, merge two FieldMasks, calculate the intersection to two FieldMasks and traverse all fields specified by the FieldMask in a message tree. Creates an empty FieldMaskTree. Creates a FieldMaskTree for a given FieldMask. Adds a field path to the tree. In a FieldMask, every field path matches the specified field as well as all its sub-fields. For example, a field path "foo.bar" matches field "foo.bar" and also "foo.bar.baz", etc. When adding a field path to the tree, redundant sub-paths will be removed. That is, after adding "foo.bar" to the tree, "foo.bar.baz" will be removed if it exists, which will turn the tree node for "foo.bar" to a leaf node. Likewise, if the field path to add is a sub-path of an existing leaf node, nothing will be changed in the tree. Merges all field paths in a FieldMask into this tree. Converts this tree to a FieldMask. Gathers all field paths in a sub-tree. Adds the intersection of this tree with the given to . Merges all fields specified by this FieldMaskTree from to . Merges all fields specified by a sub-tree from to . Class containing helpful workarounds for various platform compatibility Interface for a Protocol Buffers message, supporting parsing from and writing to . Internal implementation of merging data from given parse context into this message. Users should never invoke this method directly. Internal implementation of writing this message to a given write context. Users should never invoke this method directly. A message type that has a custom string format for diagnostic purposes. Calling on a generated message type normally returns the JSON representation. If a message type implements this interface, then the method will be called instead of the regular JSON formatting code, but only when ToString() is called either on the message itself or on another message which contains it. This does not affect the normal JSON formatting of the message. For example, if you create a proto message representing a GUID, the internal representation may be a bytes field or four fixed32 fields. However, when debugging it may be more convenient to see a result in the same format as provides. This interface extends to avoid it accidentally being implemented on types other than messages, where it would not be used by anything in the framework. Returns a string representation of this object, for diagnostic purposes. This method is called when a message is formatted as part of a call. It does not affect the JSON representation used by other than in calls to . While it is recommended that the result is valid JSON, this is never assumed by the Protobuf library. A string representation of this object, for diagnostic purposes. Generic interface for a deeply cloneable type. All generated messages implement this interface, but so do some non-message types. Additionally, due to the type constraint on T in , it is simpler to keep this as a separate interface. The type itself, returned by the method. Creates a deep clone of this object. A deep clone of this object. Generic interface for a Protocol Buffers message containing one or more extensions, where the type parameter is expected to be the same type as the implementation class. This interface is experiemental and is subject to change. Gets the value of the specified extension Gets the value of the specified repeated extension or null if the extension isn't registered in this set. For a version of this method that never returns null, use Gets the value of the specified repeated extension, registering it if it hasn't already been registered. Sets the value of the specified extension Gets whether the value of the specified extension is set Clears the value of the specified extension Clears the value of the specified repeated extension Interface for a Protocol Buffers message, supporting basic operations required for serialization. Merges the data from the specified coded input stream with the current message. See the user guide for precise merge semantics. Writes the data to the given coded output stream. Coded output stream to write the data to. Must not be null. Calculates the size of this message in Protocol Buffer wire format, in bytes. The number of bytes required to write this message to a coded output stream. Descriptor for this message. All instances are expected to return the same descriptor, and for generated types this will be an explicitly-implemented member, returning the same value as the static property declared on the type. Generic interface for a Protocol Buffers message, where the type parameter is expected to be the same type as the implementation class. The message type. Merges the given message into this one. See the user guide for precise merge semantics. The message to merge with this one. Must not be null. Thrown when an attempt is made to parse invalid JSON, e.g. using a non-string property key, or including a redundant comma. Parsing a protocol buffer message represented in JSON using can throw both this exception and depending on the situation. This exception is only thrown for "pure JSON" errors, whereas InvalidProtocolBufferException is thrown when the JSON may be valid in and of itself, but cannot be parsed as a protocol buffer message. Thrown when a protocol message being parsed is invalid in some way, e.g. it contains a malformed varint or a negative byte length. Creates an exception for an error condition of an invalid tag being encountered. Reflection-based converter from messages to JSON. Instances of this class are thread-safe, with no mutable state. This is a simple start to get JSON formatting working. As it's reflection-based, it's not as quick as baking calls into generated messages - but is a simpler implementation. (This code is generally not heavily optimized.) Returns a formatter using the default settings. The JSON representation of the first 160 characters of Unicode. Empty strings are replaced by the static constructor. Creates a new formatted with the given settings. The settings. Formats the specified message as JSON. The message to format. This method delegates to Format(IMessage, int) with indentationLevel = 0. The formatted message. Formats the specified message as JSON. The message to format. Indentation level to start at. To keep consistent indentation when embedding a message inside another JSON string, set . E.g: var response = $@"{{ ""data"": { Format(message, indentationLevel: 1) } }}" The formatted message. Formats the specified message as JSON. The message to format. The TextWriter to write the formatted message to. This method delegates to Format(IMessage, TextWriter, int) with indentationLevel = 0. The formatted message. Formats the specified message as JSON. When is not null, start indenting at the specified . The message to format. The TextWriter to write the formatted message to. Indentation level to start at. To keep consistent indentation when embedding a message inside another JSON string, set . Converts a message to JSON for diagnostic purposes with no extra context. This differs from calling on the default JSON formatter in its handling of . As no type registry is available in calls, the normal way of resolving the type of an Any message cannot be applied. Instead, a JSON property named @value is included with the base64 data from the property of the message. The value returned by this method is only designed to be used for diagnostic purposes. It may not be parsable by , and may not be parsable by other Protocol Buffer implementations. The message to format for diagnostic purposes. The diagnostic-only JSON representation of the message Determines whether or not a field value should be serialized according to the field, its value in the message, and the settings of this formatter. Writes a single value to the given writer as JSON. Only types understood by Protocol Buffers can be written in this way. This method is only exposed for advanced use cases; most users should be using or . The writer to write the value to. Must not be null. The value to write. May be null. Delegates to WriteValue(TextWriter, object, int) with indentationLevel = 0. Writes a single value to the given writer as JSON. Only types understood by Protocol Buffers can be written in this way. This method is only exposed for advanced use cases; most users should be using or . The writer to write the value to. Must not be null. The value to write. May be null. The current indentationLevel. Not used when is null. Central interception point for well-known type formatting. Any well-known types which don't need special handling can fall back to WriteMessage. We avoid assuming that the values are using the embedded well-known types, in order to allow for dynamic messages in the future. Writes a string (including leading and trailing double quotes) to a builder, escaping as required. Other than surrogate pair handling, this code is mostly taken from src/google/protobuf/util/internal/json_escaping.cc. Settings controlling JSON formatting. Default settings, as used by Whether fields which would otherwise not be included in the formatted data should be formatted even when the value is not present, or has the default value. This option only affects fields which don't support "presence" (e.g. singular non-optional proto3 primitive fields). The type registry used to format messages. Whether to format enums as ints. Defaults to false. Whether to use the original proto field names as defined in the .proto file. Defaults to false. Indentation string, used for formatting. Setting null disables indentation. Creates a new object with the specified formatting of default values and an empty type registry. true if default values (0, empty strings etc) should be formatted; false otherwise. Creates a new object with the specified formatting of default values and type registry. true if default values (0, empty strings etc) should be formatted; false otherwise. The to use when formatting messages. Creates a new object with the specified parameters. true if default values (0, empty strings etc) should be formatted; false otherwise. The to use when formatting messages. TypeRegistry.Empty will be used if it is null. true to format the enums as integers; false to format enums as enum names. true to preserve proto field names; false to convert them to lowerCamelCase. The indentation string to use for multi-line formatting. null to disable multi-line format. Creates a new object with the specified formatting of default values and the current settings. true if default values (0, empty strings etc) should be formatted; false otherwise. Creates a new object with the specified type registry and the current settings. The to use when formatting messages. Creates a new object with the specified enums formatting option and the current settings. true to format the enums as integers; false to format enums as enum names. Creates a new object with the specified field name formatting option and the current settings. true to preserve proto field names; false to convert them to lowerCamelCase. Creates a new object with the specified indentation and the current settings. The string to output for each level of indentation (nesting). The default is two spaces per level. Use null to disable indentation entirely. A non-null value for will insert additional line-breaks to the JSON output. Each line will contain either a single value, or braces. The default line-break is determined by , which is "\n" on Unix platforms, and "\r\n" on Windows. If seems to produce empty lines, you need to pass a that uses a "\n" newline. See . Reflection-based converter from JSON to messages. Instances of this class are thread-safe, with no mutable state. This is a simple start to get JSON parsing working. As it's reflection-based, it's not as quick as baking calls into generated messages - but is a simpler implementation. (This code is generally not heavily optimized.) Returns a formatter using the default settings. Creates a new formatted with the given settings. The settings. Parses and merges the information into the given message. The message to merge the JSON information into. The JSON to parse. Parses JSON read from and merges the information into the given message. The message to merge the JSON information into. Reader providing the JSON to parse. Merges the given message using data from the given tokenizer. In most cases, the next token should be a "start object" token, but wrapper types and nullity can invalidate that assumption. This is implemented as an LL(1) recursive descent parser over the stream of tokens provided by the tokenizer. This token stream is assumed to be valid JSON, with the tokenizer performing that validation - but not every token stream is valid "protobuf JSON". Parses into a new message. The type of message to create. The JSON to parse. The JSON does not comply with RFC 7159 The JSON does not represent a Protocol Buffers message correctly Parses JSON read from into a new message. The type of message to create. Reader providing the JSON to parse. The JSON does not comply with RFC 7159 The JSON does not represent a Protocol Buffers message correctly Parses into a new message. The JSON to parse. Descriptor of message type to parse. The JSON does not comply with RFC 7159 The JSON does not represent a Protocol Buffers message correctly Parses JSON read from into a new message. Reader providing the JSON to parse. Descriptor of message type to parse. The JSON does not comply with RFC 7159 The JSON does not represent a Protocol Buffers message correctly Creates a new instance of the message type for the given field. Checks that any infinite/NaN values originated from the correct text. This corrects the lenient whitespace handling of double.Parse/float.Parse, as well as the way that Mono parses out-of-range values as infinity. Settings controlling JSON parsing. Default settings, as used by . This has the same default recursion limit as , and an empty type registry. The maximum depth of messages to parse. Note that this limit only applies to parsing messages, not collections - so a message within a collection within a message only counts as depth 2, not 3. The type registry used to parse messages. Whether the parser should ignore unknown fields (true) or throw an exception when they are encountered (false). Creates a new object with the specified recursion limit. The maximum depth of messages to parse Creates a new object with the specified recursion limit and type registry. The maximum depth of messages to parse The type registry used to parse messages Creates a new object set to either ignore unknown fields, or throw an exception when unknown fields are encountered. true if unknown fields should be ignored when parsing; false to throw an exception. Creates a new object based on this one, but with the specified recursion limit. The new recursion limit. Creates a new object based on this one, but with the specified type registry. The new type registry. Must not be null. Simple but strict JSON tokenizer, rigidly following RFC 7159. This tokenizer is stateful, and only returns "useful" tokens - names, values etc. It does not create tokens for the separator between names and values, or for the comma between values. It validates the token stream as it goes - so callers can assume that the tokens it produces are appropriate. For example, it would never produce "start object, end array." Implementation details: the base class handles single token push-back and Not thread-safe. Creates a tokenizer that reads from the given text reader. Creates a tokenizer that first replays the given list of tokens, then continues reading from another tokenizer. Note that if the returned tokenizer is "pushed back", that does not push back on the continuation tokenizer, or vice versa. Care should be taken when using this method - it was created for the sake of Any parsing. Returns the depth of the stack, purely in objects (not collections). Informally, this is the number of remaining unclosed '{' characters we have. Returns the next JSON token in the stream. An EndDocument token is returned to indicate the end of the stream, after which point Next() should not be called again. This implementation provides single-token buffering, and calls if there is no buffered token. The next token in the stream. This is never null. This method is called after an EndDocument token has been returned The input text does not comply with RFC 7159 Returns the next JSON token in the stream, when requested by the base class. (The method delegates to this if it doesn't have a buffered token.) This method is called after an EndDocument token has been returned The input text does not comply with RFC 7159 Skips the value we're about to read. This must only be called immediately after reading a property name. If the value is an object or an array, the complete object/array is skipped. Tokenizer which first exhausts a list of tokens, then consults another tokenizer. Tokenizer which does all the *real* work of parsing JSON. This method essentially just loops through characters skipping whitespace, validating and changing state (e.g. from ObjectBeforeColon to ObjectAfterColon) until it reaches something which will be a genuine token (e.g. a start object, or a value) at which point it returns the token. Although the method is large, it would be relatively hard to break down further... most of it is the large switch statement, which sometimes returns and sometimes doesn't. Reads a string token. It is assumed that the opening " has already been read. Reads an escaped character. It is assumed that the leading backslash has already been read. Reads an escaped Unicode 4-nybble hex sequence. It is assumed that the leading \u has already been read. Consumes a text-only literal, throwing an exception if the read text doesn't match it. It is assumed that the first letter of the literal has already been read. Validates that we're in a valid state to read a value (using the given error prefix if necessary) and changes the state to the appropriate one, e.g. ObjectAfterColon to ObjectAfterProperty. Pops the top-most container, and sets the state to the appropriate one for the end of a value in the parent container. Possible states of the tokenizer. This is a flags enum purely so we can simply and efficiently represent a set of valid states for checking. Each is documented with an example, where ^ represents the current position within the text stream. The examples all use string values, but could be any value, including nested objects/arrays. The complete state of the tokenizer also includes a stack to indicate the contexts (arrays/objects). Any additional notional state of "AfterValue" indicates that a value has been completed, at which point there's an immediate transition to ExpectedEndOfDocument, ObjectAfterProperty or ArrayAfterValue. These states were derived manually by reading RFC 7159 carefully. ^ { "foo": "bar" } Before the value in a document. Next states: ObjectStart, ArrayStart, "AfterValue" { "foo": "bar" } ^ After the value in a document. Next states: ReaderExhausted { "foo": "bar" } ^ (and already read to the end of the reader) Terminal state. { ^ "foo": "bar" } Before the *first* property in an object. Next states: "AfterValue" (empty object) ObjectBeforeColon (read a name) { "foo" ^ : "bar", "x": "y" } Next state: ObjectAfterColon { "foo" : ^ "bar", "x": "y" } Before any property other than the first in an object. (Equivalently: after any property in an object) Next states: "AfterValue" (value is simple) ObjectStart (value is object) ArrayStart (value is array) { "foo" : "bar" ^ , "x" : "y" } At the end of a property, so expecting either a comma or end-of-object Next states: ObjectAfterComma or "AfterValue" { "foo":"bar", ^ "x":"y" } Read the comma after the previous property, so expecting another property. This is like ObjectStart, but closing brace isn't valid here Next state: ObjectBeforeColon. [ ^ "foo", "bar" ] Before the *first* value in an array. Next states: "AfterValue" (read a value) "AfterValue" (end of array; will pop stack) [ "foo" ^ , "bar" ] After any value in an array, so expecting either a comma or end-of-array Next states: ArrayAfterComma or "AfterValue" [ "foo", ^ "bar" ] After a comma in an array, so there *must* be another value (simple or complex). Next states: "AfterValue" (simple value), StartObject, StartArray Wrapper around a text reader allowing small amounts of buffering and location handling. The buffered next character, if we have one. Returns the next character in the stream, or null if we have reached the end. Creates a new exception appropriate for the current state of the reader. Stream implementation which proxies another stream, only allowing a certain amount of data to be read. Note that this is only used to read delimited streams, so it doesn't attempt to implement everything. Extension methods on and . Merges data from the given byte array into an existing message. The message to merge the data into. The data to merge, which must be protobuf-encoded binary data. Merges data from the given byte array slice into an existing message. The message to merge the data into. The data containing the slice to merge, which must be protobuf-encoded binary data. The offset of the slice to merge. The length of the slice to merge. Merges data from the given byte string into an existing message. The message to merge the data into. The data to merge, which must be protobuf-encoded binary data. Merges data from the given stream into an existing message. The message to merge the data into. Stream containing the data to merge, which must be protobuf-encoded binary data. Merges data from the given span into an existing message. The message to merge the data into. Span containing the data to merge, which must be protobuf-encoded binary data. Merges data from the given sequence into an existing message. The message to merge the data into. Sequence from the specified data to merge, which must be protobuf-encoded binary data. Merges length-delimited data from the given stream into an existing message. The stream is expected to contain a length and then the data. Only the amount of data specified by the length will be consumed. The message to merge the data into. Stream containing the data to merge, which must be protobuf-encoded binary data. Converts the given message into a byte array in protobuf encoding. The message to convert. The message data as a byte array. Writes the given message data to the given stream in protobuf encoding. The message to write to the stream. The stream to write to. Writes the length and then data of the given message to a stream. The message to write. The output stream to write to. Converts the given message into a byte string in protobuf encoding. The message to convert. The message data as a byte string. Writes the given message data to the given buffer writer in protobuf encoding. The message to write to the stream. The stream to write to. Writes the given message data to the given span in protobuf encoding. The size of the destination span needs to fit the serialized size of the message exactly, otherwise an exception is thrown. The message to write to the stream. The span to write to. Size must match size of the message exactly. Checks if all required fields in a message have values set. For proto3 messages, this returns true A general message parser, typically used by reflection-based code as all the methods return simple . Creates a template instance ready for population. An empty message. Parses a message from a byte array. The byte array containing the message. Must not be null. The newly parsed message. Parses a message from a byte array slice. The byte array containing the message. Must not be null. The offset of the slice to parse. The length of the slice to parse. The newly parsed message. Parses a message from the given byte string. The data to parse. The parsed message. Parses a message from the given stream. The stream to parse. The parsed message. Parses a message from the given sequence. The data to parse. The parsed message. Parses a message from the given span. The data to parse. The parsed message. Parses a length-delimited message from the given stream. The stream is expected to contain a length and then the data. Only the amount of data specified by the length will be consumed. The stream to parse. The parsed message. Parses a message from the given coded input stream. The stream to parse. The parsed message. Parses a message from the given JSON. This method always uses the default JSON parser; it is not affected by . To ignore unknown fields when parsing JSON, create a using a with set to true and call directly. The JSON to parse. The parsed message. The JSON does not comply with RFC 7159 The JSON does not represent a Protocol Buffers message correctly Creates a new message parser which optionally discards unknown fields when parsing. Note that this does not affect the behavior of at all. To ignore unknown fields when parsing JSON, create a using a with set to true and call directly. Whether or not to discard unknown fields when parsing. A newly configured message parser. Creates a new message parser which registers extensions from the specified registry upon creating the message instance The extensions to register A newly configured message parser. A parser for a specific message type.

This delegates most behavior to the implementation within the original type, but provides convenient overloads to parse from a variety of sources.

Most applications will never need to create their own instances of this type; instead, use the static Parser property of a generated message type to obtain a parser for that type.

The type of message to be parsed.
Creates a new parser. The factory method is effectively an optimization over using a generic constraint to require a parameterless constructor: delegates are significantly faster to execute. Function to invoke when a new, empty message is required. Creates a template instance ready for population. An empty message. Parses a message from a byte array. The byte array containing the message. Must not be null. The newly parsed message. Parses a message from a byte array slice. The byte array containing the message. Must not be null. The offset of the slice to parse. The length of the slice to parse. The newly parsed message. Parses a message from the given byte string. The data to parse. The parsed message. Parses a message from the given stream. The stream to parse. The parsed message. Parses a message from the given sequence. The data to parse. The parsed message. Parses a message from the given span. The data to parse. The parsed message. Parses a length-delimited message from the given stream. The stream is expected to contain a length and then the data. Only the amount of data specified by the length will be consumed. The stream to parse. The parsed message. Parses a message from the given coded input stream. The stream to parse. The parsed message. Parses a message from the given JSON. The JSON to parse. The parsed message. The JSON does not comply with RFC 7159 The JSON does not represent a Protocol Buffers message correctly Creates a new message parser which optionally discards unknown fields when parsing. Whether or not to discard unknown fields when parsing. A newly configured message parser. Creates a new message parser which registers extensions from the specified registry upon creating the message instance The extensions to register A newly configured message parser. Struct used to hold the keys for the fieldByNumber table in DescriptorPool and the keys for the extensionByNumber table in ExtensionRegistry. An opaque struct that represents the current parsing state and is passed along as the parsing proceeds. All the public methods are intended to be invoked only by the generated code, users should never invoke them directly. Initialize a , building all from defaults and the given . Initialize a using existing , e.g. from . Creates a ParseContext instance from CodedInputStream. WARNING: internally this copies the CodedInputStream's state, so after done with the ParseContext, the CodedInputStream's state needs to be updated. Returns the last tag read, or 0 if no tags have been read or we've read beyond the end of the input. Internal-only property; when set to true, unknown fields will be discarded while parsing. Internal-only property; provides extension identifiers to compatible messages while parsing. Reads a field tag, returning the tag of 0 for "end of input". If this method returns 0, it doesn't necessarily mean the end of all the data in this CodedInputReader; it may be the end of the logical input for an embedded message, for example. The next field tag, or 0 for end of input. (0 is never a valid tag.) Reads a double field from the input. Reads a float field from the input. Reads a uint64 field from the input. Reads an int64 field from the input. Reads an int32 field from the input. Reads a fixed64 field from the input. Reads a fixed32 field from the input. Reads a bool field from the input. Reads a string field from the input. Reads an embedded message field value from the input. Reads an embedded group field from the input. Reads a bytes field value from the input. Reads a uint32 field value from the input. Reads an enum field value from the input. Reads an sfixed32 field value from the input. Reads an sfixed64 field value from the input. Reads an sint32 field value from the input. Reads an sint64 field value from the input. Reads a length for length-delimited data. This is internally just reading a varint, but this method exists to make the calling code clearer. The position within the current buffer (i.e. the next byte to read) Size of the current buffer If we are currently inside a length-delimited block, this is the number of bytes in the buffer that are still available once we leave the delimited block. The absolute position of the end of the current length-delimited block (including totalBytesRetired) The total number of consumed before the start of the current buffer. The total bytes read up to the current position can be computed as totalBytesRetired + bufferPos. The last tag we read. 0 indicates we've read to the end of the stream (or haven't read anything yet). The next tag, used to store the value read by PeekTag. Internal-only property; when set to true, unknown fields will be discarded while parsing. Internal-only property; provides extension identifiers to compatible messages while parsing. Primitives for parsing protobuf wire format. Reads a length for length-delimited data. This is internally just reading a varint, but this method exists to make the calling code clearer. Parses the next tag. If the end of logical stream was reached, an invalid tag of 0 is returned. Peeks at the next tag in the stream. If it matches , the tag is consumed and the method returns true; otherwise, the stream is left in the original position and the method returns false. Peeks at the next field tag. This is like calling , but the tag is not consumed. (So a subsequent call to will return the same value.) Parses a raw varint. 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 32-bit little-endian integer. Parses a 64-bit little-endian integer. Parses a double value. Parses a float value. Reads a fixed size of bytes from the input. the end of the stream or the current limit was reached Reads and discards bytes. the end of the stream or the current limit was reached Reads a string field value from the input. Reads a bytes field value from the input. Reads a UTF-8 string from the next "length" bytes. the end of the stream or the current limit was reached Reads a string assuming that it is spread across multiple spans in a . Validates that the specified size doesn't exceed the current limit. If it does then remaining bytes are skipped and an error is thrown. 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. Decode a 32-bit value with ZigZag encoding. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 32 bits to be varint encoded, thus always taking 5 bytes on the wire.) Decode a 64-bit value with ZigZag encoding. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.) 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. Checks whether there is known data available of the specified size remaining to parse in the underlying data source. When parsing from a Stream this will return false because we have no knowledge of the amount of data remaining in the stream until it is read. Read raw bytes of the specified length into a span. The amount of data available and the current limit should be checked before calling this method. Reading and skipping messages / groups Skip a group. Verifies that the last call to ReadTag() returned tag 0 - in other words, we've reached the end of the stream when we expected to. The tag read was not the one specified Fast parsing primitives for wrapper types Helper methods for throwing exceptions when preconditions are not met. This class is used internally and by generated code; it is not particularly expected to be used from application code, although nothing prevents it from being used that way. Throws an ArgumentNullException if the given value is null, otherwise return the value to the caller. Throws an ArgumentNullException if the given value is null, otherwise return the value to the caller. This is equivalent to but without the type parameter constraint. In most cases, the constraint is useful to prevent you from calling CheckNotNull with a value type - but it gets in the way if either you want to use it with a nullable value type, or you want to use it with an unconstrained type parameter. Container for a set of custom options specified within a message, field etc. This type is publicly immutable, but internally mutable. It is only populated by the descriptor parsing code - by the time any user code is able to see an instance, it will be fully initialized. If an option is requested using the incorrect method, an answer may still be returned: all of the numeric types are represented internally using 64-bit integers, for example. It is up to the caller to ensure that they make the appropriate method call for the option they're interested in. Note that enum options are simply stored as integers, so the value should be fetched using and then cast appropriately. Repeated options are currently not supported. Asking for a single value of an option which was actually repeated will return the last value, except for message types where all the set values are merged together. Retrieves a Boolean value for the specified option field. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a signed 32-bit integer value for the specified option field. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a signed 64-bit integer value for the specified option field. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves an unsigned 32-bit integer value for the specified option field, assuming a fixed-length representation. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves an unsigned 64-bit integer value for the specified option field, assuming a fixed-length representation. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a signed 32-bit integer value for the specified option field, assuming a fixed-length representation. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a signed 64-bit integer value for the specified option field, assuming a fixed-length representation. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a signed 32-bit integer value for the specified option field, assuming a zigzag encoding. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a signed 64-bit integer value for the specified option field, assuming a zigzag encoding. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves an unsigned 32-bit integer value for the specified option field. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves an unsigned 64-bit integer value for the specified option field. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a 32-bit floating point value for the specified option field. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a 64-bit floating point value for the specified option field. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a string value for the specified option field. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a bytes value for the specified option field. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Retrieves a message value for the specified option field. The field to fetch the value for. The output variable to populate. true if a suitable value for the field was found; false otherwise. Holder for reflection information generated from google/protobuf/descriptor.proto File descriptor for google/protobuf/descriptor.proto The protocol compiler can output a FileDescriptorSet containing the .proto files it parses. Field number for the "file" field. Describes a complete .proto file. Field number for the "name" field. file name, relative to root of source tree Gets whether the "name" field is set Clears the value of the "name" field Field number for the "package" field. e.g. "foo", "foo.bar", etc. Gets whether the "package" field is set Clears the value of the "package" field Field number for the "dependency" field. Names of files imported by this file. Field number for the "public_dependency" field. Indexes of the public imported files in the dependency list above. Field number for the "weak_dependency" field. Indexes of the weak imported files in the dependency list. For Google-internal migration only. Do not use. Field number for the "message_type" field. All top-level definitions in this file. Field number for the "enum_type" field. Field number for the "service" field. Field number for the "extension" field. Field number for the "options" field. Field number for the "source_code_info" field. This field contains optional information about the original source code. You may safely remove this entire field without harming runtime functionality of the descriptors -- the information is needed only by development tools. Field number for the "syntax" field. The syntax of the proto file. The supported values are "proto2", "proto3", and "editions". If `edition` is present, this value must be "editions". Gets whether the "syntax" field is set Clears the value of the "syntax" field Field number for the "edition" field. The edition of the proto file, which is an opaque string. Gets whether the "edition" field is set Clears the value of the "edition" field Describes a message type. Field number for the "name" field. Gets whether the "name" field is set Clears the value of the "name" field Field number for the "field" field. Field number for the "extension" field. Field number for the "nested_type" field. Field number for the "enum_type" field. Field number for the "extension_range" field. Field number for the "oneof_decl" field. Field number for the "options" field. Field number for the "reserved_range" field. Field number for the "reserved_name" field. Reserved field names, which may not be used by fields in the same message. A given name may only be reserved once. Container for nested types declared in the DescriptorProto message type. Field number for the "start" field. Inclusive. Gets whether the "start" field is set Clears the value of the "start" field Field number for the "end" field. Exclusive. Gets whether the "end" field is set Clears the value of the "end" field Field number for the "options" field. Range of reserved tag numbers. Reserved tag numbers may not be used by fields or extension ranges in the same message. Reserved ranges may not overlap. Field number for the "start" field. Inclusive. Gets whether the "start" field is set Clears the value of the "start" field Field number for the "end" field. Exclusive. Gets whether the "end" field is set Clears the value of the "end" field Field number for the "uninterpreted_option" field. The parser stores options it doesn't recognize here. See above. Field number for the "declaration" field. go/protobuf-stripping-extension-declarations Like Metadata, but we use a repeated field to hold all extension declarations. This should avoid the size increases of transforming a large extension range into small ranges in generated binaries. Field number for the "verification" field. The verification state of the range. TODO(b/278783756): flip the default to DECLARATION once all empty ranges are marked as UNVERIFIED. Gets whether the "verification" field is set Clears the value of the "verification" field Container for nested types declared in the ExtensionRangeOptions message type. The verification state of the extension range. All the extensions of the range must be declared. Field number for the "number" field. The extension number declared within the extension range. Gets whether the "number" field is set Clears the value of the "number" field Field number for the "full_name" field. The fully-qualified name of the extension field. There must be a leading dot in front of the full name. Gets whether the "full_name" field is set Clears the value of the "full_name" field Field number for the "type" field. The fully-qualified type name of the extension field. Unlike Metadata.type, Declaration.type must have a leading dot for messages and enums. Gets whether the "type" field is set Clears the value of the "type" field Field number for the "is_repeated" field. Deprecated. Please use "repeated". Gets whether the "is_repeated" field is set Clears the value of the "is_repeated" field Field number for the "reserved" field. If true, indicates that the number is reserved in the extension range, and any extension field with the number will fail to compile. Set this when a declared extension field is deleted. Gets whether the "reserved" field is set Clears the value of the "reserved" field Field number for the "repeated" field. If true, indicates that the extension must be defined as repeated. Otherwise the extension must be defined as optional. Gets whether the "repeated" field is set Clears the value of the "repeated" field Describes a field within a message. Field number for the "name" field. Gets whether the "name" field is set Clears the value of the "name" field Field number for the "number" field. Gets whether the "number" field is set Clears the value of the "number" field Field number for the "label" field. Gets whether the "label" field is set Clears the value of the "label" field Field number for the "type" field. If type_name is set, this need not be set. If both this and type_name are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. Gets whether the "type" field is set Clears the value of the "type" field Field number for the "type_name" field. For message and enum types, this is the name of the type. If the name starts with a '.', it is fully-qualified. Otherwise, C++-like scoping rules are used to find the type (i.e. first the nested types within this message are searched, then within the parent, on up to the root namespace). Gets whether the "type_name" field is set Clears the value of the "type_name" field Field number for the "extendee" field. For extensions, this is the name of the type being extended. It is resolved in the same manner as type_name. Gets whether the "extendee" field is set Clears the value of the "extendee" field Field number for the "default_value" field. For numeric types, contains the original text representation of the value. For booleans, "true" or "false". For strings, contains the default text contents (not escaped in any way). For bytes, contains the C escaped value. All bytes >= 128 are escaped. Gets whether the "default_value" field is set Clears the value of the "default_value" field Field number for the "oneof_index" field. If set, gives the index of a oneof in the containing type's oneof_decl list. This field is a member of that oneof. Gets whether the "oneof_index" field is set Clears the value of the "oneof_index" field Field number for the "json_name" field. JSON name of this field. The value is set by protocol compiler. If the user has set a "json_name" option on this field, that option's value will be used. Otherwise, it's deduced from the field's name by converting it to camelCase. Gets whether the "json_name" field is set Clears the value of the "json_name" field Field number for the "options" field. Field number for the "proto3_optional" field. If true, this is a proto3 "optional". When a proto3 field is optional, it tracks presence regardless of field type. When proto3_optional is true, this field must be belong to a oneof to signal to old proto3 clients that presence is tracked for this field. This oneof is known as a "synthetic" oneof, and this field must be its sole member (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs exist in the descriptor only, and do not generate any API. Synthetic oneofs must be ordered after all "real" oneofs. For message fields, proto3_optional doesn't create any semantic change, since non-repeated message fields always track presence. However it still indicates the semantic detail of whether the user wrote "optional" or not. This can be useful for round-tripping the .proto file. For consistency we give message fields a synthetic oneof also, even though it is not required to track presence. This is especially important because the parser can't tell if a field is a message or an enum, so it must always create a synthetic oneof. Proto2 optional fields do not set this flag, because they already indicate optional with `LABEL_OPTIONAL`. Gets whether the "proto3_optional" field is set Clears the value of the "proto3_optional" field Container for nested types declared in the FieldDescriptorProto message type. 0 is reserved for errors. Order is weird for historical reasons. Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if negative values are likely. Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if negative values are likely. Tag-delimited aggregate. Group type is deprecated and not supported in proto3. However, Proto3 implementations should still be able to parse the group wire format and treat group fields as unknown fields. Length-delimited aggregate. New in version 2. Uses ZigZag encoding. Uses ZigZag encoding. 0 is reserved for errors Describes a oneof. Field number for the "name" field. Gets whether the "name" field is set Clears the value of the "name" field Field number for the "options" field. Describes an enum type. Field number for the "name" field. Gets whether the "name" field is set Clears the value of the "name" field Field number for the "value" field. Field number for the "options" field. Field number for the "reserved_range" field. Range of reserved numeric values. Reserved numeric values may not be used by enum values in the same enum declaration. Reserved ranges may not overlap. Field number for the "reserved_name" field. Reserved enum value names, which may not be reused. A given name may only be reserved once. Container for nested types declared in the EnumDescriptorProto message type. Range of reserved numeric values. Reserved values may not be used by entries in the same enum. Reserved ranges may not overlap. Note that this is distinct from DescriptorProto.ReservedRange in that it is inclusive such that it can appropriately represent the entire int32 domain. Field number for the "start" field. Inclusive. Gets whether the "start" field is set Clears the value of the "start" field Field number for the "end" field. Inclusive. Gets whether the "end" field is set Clears the value of the "end" field Describes a value within an enum. Field number for the "name" field. Gets whether the "name" field is set Clears the value of the "name" field Field number for the "number" field. Gets whether the "number" field is set Clears the value of the "number" field Field number for the "options" field. Describes a service. Field number for the "name" field. Gets whether the "name" field is set Clears the value of the "name" field Field number for the "method" field. Field number for the "options" field. Describes a method of a service. Field number for the "name" field. Gets whether the "name" field is set Clears the value of the "name" field Field number for the "input_type" field. Input and output type names. These are resolved in the same way as FieldDescriptorProto.type_name, but must refer to a message type. Gets whether the "input_type" field is set Clears the value of the "input_type" field Field number for the "output_type" field. Gets whether the "output_type" field is set Clears the value of the "output_type" field Field number for the "options" field. Field number for the "client_streaming" field. Identifies if client streams multiple client messages Gets whether the "client_streaming" field is set Clears the value of the "client_streaming" field Field number for the "server_streaming" field. Identifies if server streams multiple server messages Gets whether the "server_streaming" field is set Clears the value of the "server_streaming" field Field number for the "java_package" field. Sets the Java package where classes generated from this .proto will be placed. By default, the proto package is used, but this is often inappropriate because proto packages do not normally start with backwards domain names. Gets whether the "java_package" field is set Clears the value of the "java_package" field Field number for the "java_outer_classname" field. Controls the name of the wrapper Java class generated for the .proto file. That class will always contain the .proto file's getDescriptor() method as well as any top-level extensions defined in the .proto file. If java_multiple_files is disabled, then all the other classes from the .proto file will be nested inside the single wrapper outer class. Gets whether the "java_outer_classname" field is set Clears the value of the "java_outer_classname" field Field number for the "java_multiple_files" field. If enabled, then the Java code generator will generate a separate .java file for each top-level message, enum, and service defined in the .proto file. Thus, these types will *not* be nested inside the wrapper class named by java_outer_classname. However, the wrapper class will still be generated to contain the file's getDescriptor() method as well as any top-level extensions defined in the file. Gets whether the "java_multiple_files" field is set Clears the value of the "java_multiple_files" field Field number for the "java_generate_equals_and_hash" field. This option does nothing. Gets whether the "java_generate_equals_and_hash" field is set Clears the value of the "java_generate_equals_and_hash" field Field number for the "java_string_check_utf8" field. If set true, then the Java2 code generator will generate code that throws an exception whenever an attempt is made to assign a non-UTF-8 byte sequence to a string field. Message reflection will do the same. However, an extension field still accepts non-UTF-8 byte sequences. This option has no effect on when used with the lite runtime. Gets whether the "java_string_check_utf8" field is set Clears the value of the "java_string_check_utf8" field Field number for the "optimize_for" field. Gets whether the "optimize_for" field is set Clears the value of the "optimize_for" field Field number for the "go_package" field. Sets the Go package where structs generated from this .proto will be placed. If omitted, the Go package will be derived from the following: - The basename of the package import path, if provided. - Otherwise, the package statement in the .proto file, if present. - Otherwise, the basename of the .proto file, without extension. Gets whether the "go_package" field is set Clears the value of the "go_package" field Field number for the "cc_generic_services" field. Should generic services be generated in each language? "Generic" services are not specific to any particular RPC system. They are generated by the main code generators in each language (without additional plugins). Generic services were the only kind of service generation supported by early versions of google.protobuf. Generic services are now considered deprecated in favor of using plugins that generate code specific to your particular RPC system. Therefore, these default to false. Old code which depends on generic services should explicitly set them to true. Gets whether the "cc_generic_services" field is set Clears the value of the "cc_generic_services" field Field number for the "java_generic_services" field. Gets whether the "java_generic_services" field is set Clears the value of the "java_generic_services" field Field number for the "py_generic_services" field. Gets whether the "py_generic_services" field is set Clears the value of the "py_generic_services" field Field number for the "php_generic_services" field. Gets whether the "php_generic_services" field is set Clears the value of the "php_generic_services" field Field number for the "deprecated" field. Is this file deprecated? Depending on the target platform, this can emit Deprecated annotations for everything in the file, or it will be completely ignored; in the very least, this is a formalization for deprecating files. Gets whether the "deprecated" field is set Clears the value of the "deprecated" field Field number for the "cc_enable_arenas" field. Enables the use of arenas for the proto messages in this file. This applies only to generated classes for C++. Gets whether the "cc_enable_arenas" field is set Clears the value of the "cc_enable_arenas" field Field number for the "objc_class_prefix" field. Sets the objective c class prefix which is prepended to all objective c generated classes from this .proto. There is no default. Gets whether the "objc_class_prefix" field is set Clears the value of the "objc_class_prefix" field Field number for the "csharp_namespace" field. Namespace for generated classes; defaults to the package. Gets whether the "csharp_namespace" field is set Clears the value of the "csharp_namespace" field Field number for the "swift_prefix" field. By default Swift generators will take the proto package and CamelCase it replacing '.' with underscore and use that to prefix the types/symbols defined. When this options is provided, they will use this value instead to prefix the types/symbols defined. Gets whether the "swift_prefix" field is set Clears the value of the "swift_prefix" field Field number for the "php_class_prefix" field. Sets the php class prefix which is prepended to all php generated classes from this .proto. Default is empty. Gets whether the "php_class_prefix" field is set Clears the value of the "php_class_prefix" field Field number for the "php_namespace" field. Use this option to change the namespace of php generated classes. Default is empty. When this option is empty, the package name will be used for determining the namespace. Gets whether the "php_namespace" field is set Clears the value of the "php_namespace" field Field number for the "php_metadata_namespace" field. Use this option to change the namespace of php generated metadata classes. Default is empty. When this option is empty, the proto file name will be used for determining the namespace. Gets whether the "php_metadata_namespace" field is set Clears the value of the "php_metadata_namespace" field Field number for the "ruby_package" field. Use this option to change the package of ruby generated classes. Default is empty. When this option is not set, the package name will be used for determining the ruby package. Gets whether the "ruby_package" field is set Clears the value of the "ruby_package" field Field number for the "uninterpreted_option" field. The parser stores options it doesn't recognize here. See the documentation for the "Options" section above. Container for nested types declared in the FileOptions message type. Generated classes can be optimized for speed or code size. Generate complete code for parsing, serialization, etc. Generate code using MessageLite and the lite runtime. Field number for the "message_set_wire_format" field. Set true to use the old proto1 MessageSet wire format for extensions. This is provided for backwards-compatibility with the MessageSet wire format. You should not use this for any other reason: It's less efficient, has fewer features, and is more complicated. The message must be defined exactly as follows: message Foo { option message_set_wire_format = true; extensions 4 to max; } Note that the message cannot have any defined fields; MessageSets only have extensions. All extensions of your type must be singular messages; e.g. they cannot be int32s, enums, or repeated messages. Because this is an option, the above two restrictions are not enforced by the protocol compiler. Gets whether the "message_set_wire_format" field is set Clears the value of the "message_set_wire_format" field Field number for the "no_standard_descriptor_accessor" field. Disables the generation of the standard "descriptor()" accessor, which can conflict with a field of the same name. This is meant to make migration from proto1 easier; new code should avoid fields named "descriptor". Gets whether the "no_standard_descriptor_accessor" field is set Clears the value of the "no_standard_descriptor_accessor" field Field number for the "deprecated" field. Is this message deprecated? Depending on the target platform, this can emit Deprecated annotations for the message, or it will be completely ignored; in the very least, this is a formalization for deprecating messages. Gets whether the "deprecated" field is set Clears the value of the "deprecated" field Field number for the "map_entry" field. NOTE: Do not set the option in .proto files. Always use the maps syntax instead. The option should only be implicitly set by the proto compiler parser. Whether the message is an automatically generated map entry type for the maps field. For maps fields: map<KeyType, ValueType> map_field = 1; The parsed descriptor looks like: message MapFieldEntry { option map_entry = true; optional KeyType key = 1; optional ValueType value = 2; } repeated MapFieldEntry map_field = 1; Implementations may choose not to generate the map_entry=true message, but use a native map in the target language to hold the keys and values. The reflection APIs in such implementations still need to work as if the field is a repeated message field. Gets whether the "map_entry" field is set Clears the value of the "map_entry" field Field number for the "deprecated_legacy_json_field_conflicts" field. Enable the legacy handling of JSON field name conflicts. This lowercases and strips underscored from the fields before comparison in proto3 only. The new behavior takes `json_name` into account and applies to proto2 as well. This should only be used as a temporary measure against broken builds due to the change in behavior for JSON field name conflicts. TODO(b/261750190) This is legacy behavior we plan to remove once downstream teams have had time to migrate. Gets whether the "deprecated_legacy_json_field_conflicts" field is set Clears the value of the "deprecated_legacy_json_field_conflicts" field Field number for the "uninterpreted_option" field. The parser stores options it doesn't recognize here. See above. Field number for the "ctype" field. The ctype option instructs the C++ code generator to use a different representation of the field than it normally would. See the specific options below. This option is only implemented to support use of [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of type "bytes" in the open source release -- sorry, we'll try to include other types in a future version! Gets whether the "ctype" field is set Clears the value of the "ctype" field Field number for the "packed" field. The packed option can be enabled for repeated primitive fields to enable a more efficient representation on the wire. Rather than repeatedly writing the tag and type for each element, the entire array is encoded as a single length-delimited blob. In proto3, only explicit setting it to false will avoid using packed encoding. Gets whether the "packed" field is set Clears the value of the "packed" field Field number for the "jstype" field. The jstype option determines the JavaScript type used for values of the field. The option is permitted only for 64 bit integral and fixed types (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING is represented as JavaScript string, which avoids loss of precision that can happen when a large value is converted to a floating point JavaScript. Specifying JS_NUMBER for the jstype causes the generated JavaScript code to use the JavaScript "number" type. The behavior of the default option JS_NORMAL is implementation dependent. This option is an enum to permit additional types to be added, e.g. goog.math.Integer. Gets whether the "jstype" field is set Clears the value of the "jstype" field Field number for the "lazy" field. Should this field be parsed lazily? Lazy applies only to message-type fields. It means that when the outer message is initially parsed, the inner message's contents will not be parsed but instead stored in encoded form. The inner message will actually be parsed when it is first accessed. This is only a hint. Implementations are free to choose whether to use eager or lazy parsing regardless of the value of this option. However, setting this option true suggests that the protocol author believes that using lazy parsing on this field is worth the additional bookkeeping overhead typically needed to implement it. This option does not affect the public interface of any generated code; all method signatures remain the same. Furthermore, thread-safety of the interface is not affected by this option; const methods remain safe to call from multiple threads concurrently, while non-const methods continue to require exclusive access. Note that implementations may choose not to check required fields within a lazy sub-message. That is, calling IsInitialized() on the outer message may return true even if the inner message has missing required fields. This is necessary because otherwise the inner message would have to be parsed in order to perform the check, defeating the purpose of lazy parsing. An implementation which chooses not to check required fields must be consistent about it. That is, for any particular sub-message, the implementation must either *always* check its required fields, or *never* check its required fields, regardless of whether or not the message has been parsed. As of May 2022, lazy verifies the contents of the byte stream during parsing. An invalid byte stream will cause the overall parsing to fail. Gets whether the "lazy" field is set Clears the value of the "lazy" field Field number for the "unverified_lazy" field. unverified_lazy does no correctness checks on the byte stream. This should only be used where lazy with verification is prohibitive for performance reasons. Gets whether the "unverified_lazy" field is set Clears the value of the "unverified_lazy" field Field number for the "deprecated" field. Is this field deprecated? Depending on the target platform, this can emit Deprecated annotations for accessors, or it will be completely ignored; in the very least, this is a formalization for deprecating fields. Gets whether the "deprecated" field is set Clears the value of the "deprecated" field Field number for the "weak" field. For Google-internal migration only. Do not use. Gets whether the "weak" field is set Clears the value of the "weak" field Field number for the "debug_redact" field. Indicate that the field value should not be printed out when using debug formats, e.g. when the field contains sensitive credentials. Gets whether the "debug_redact" field is set Clears the value of the "debug_redact" field Field number for the "retention" field. Gets whether the "retention" field is set Clears the value of the "retention" field Field number for the "target" field. Gets whether the "target" field is set Clears the value of the "target" field Field number for the "targets" field. Field number for the "uninterpreted_option" field. The parser stores options it doesn't recognize here. See above. Container for nested types declared in the FieldOptions message type. Default mode. The option [ctype=CORD] may be applied to a non-repeated field of type "bytes". It indicates that in C++, the data should be stored in a Cord instead of a string. For very large strings, this may reduce memory fragmentation. It may also allow better performance when parsing from a Cord, or when parsing with aliasing enabled, as the parsed Cord may then alias the original buffer. Use the default type. Use JavaScript strings. Use JavaScript numbers. If set to RETENTION_SOURCE, the option will be omitted from the binary. Note: as of January 2023, support for this is in progress and does not yet have an effect (b/264593489). This indicates the types of entities that the field may apply to when used as an option. If it is unset, then the field may be freely used as an option on any kind of entity. Note: as of January 2023, support for this is in progress and does not yet have an effect (b/264593489). Field number for the "uninterpreted_option" field. The parser stores options it doesn't recognize here. See above. Field number for the "allow_alias" field. Set this option to true to allow mapping different tag names to the same value. Gets whether the "allow_alias" field is set Clears the value of the "allow_alias" field Field number for the "deprecated" field. Is this enum deprecated? Depending on the target platform, this can emit Deprecated annotations for the enum, or it will be completely ignored; in the very least, this is a formalization for deprecating enums. Gets whether the "deprecated" field is set Clears the value of the "deprecated" field Field number for the "deprecated_legacy_json_field_conflicts" field. Enable the legacy handling of JSON field name conflicts. This lowercases and strips underscored from the fields before comparison in proto3 only. The new behavior takes `json_name` into account and applies to proto2 as well. TODO(b/261750190) Remove this legacy behavior once downstream teams have had time to migrate. Gets whether the "deprecated_legacy_json_field_conflicts" field is set Clears the value of the "deprecated_legacy_json_field_conflicts" field Field number for the "uninterpreted_option" field. The parser stores options it doesn't recognize here. See above. Field number for the "deprecated" field. Is this enum value deprecated? Depending on the target platform, this can emit Deprecated annotations for the enum value, or it will be completely ignored; in the very least, this is a formalization for deprecating enum values. Gets whether the "deprecated" field is set Clears the value of the "deprecated" field Field number for the "uninterpreted_option" field. The parser stores options it doesn't recognize here. See above. Field number for the "deprecated" field. Is this service deprecated? Depending on the target platform, this can emit Deprecated annotations for the service, or it will be completely ignored; in the very least, this is a formalization for deprecating services. Gets whether the "deprecated" field is set Clears the value of the "deprecated" field Field number for the "uninterpreted_option" field. The parser stores options it doesn't recognize here. See above. Field number for the "deprecated" field. Is this method deprecated? Depending on the target platform, this can emit Deprecated annotations for the method, or it will be completely ignored; in the very least, this is a formalization for deprecating methods. Gets whether the "deprecated" field is set Clears the value of the "deprecated" field Field number for the "idempotency_level" field. Gets whether the "idempotency_level" field is set Clears the value of the "idempotency_level" field Field number for the "uninterpreted_option" field. The parser stores options it doesn't recognize here. See above. Container for nested types declared in the MethodOptions message type. Is this method side-effect-free (or safe in HTTP parlance), or idempotent, or neither? HTTP based RPC implementation may choose GET verb for safe methods, and PUT verb for idempotent methods instead of the default POST. implies idempotent idempotent, but may have side effects A message representing a option the parser does not recognize. This only appears in options protos created by the compiler::Parser class. DescriptorPool resolves these when building Descriptor objects. Therefore, options protos in descriptor objects (e.g. returned by Descriptor::options(), or produced by Descriptor::CopyTo()) will never have UninterpretedOptions in them. Field number for the "name" field. Field number for the "identifier_value" field. The value of the uninterpreted option, in whatever type the tokenizer identified it as during parsing. Exactly one of these should be set. Gets whether the "identifier_value" field is set Clears the value of the "identifier_value" field Field number for the "positive_int_value" field. Gets whether the "positive_int_value" field is set Clears the value of the "positive_int_value" field Field number for the "negative_int_value" field. Gets whether the "negative_int_value" field is set Clears the value of the "negative_int_value" field Field number for the "double_value" field. Gets whether the "double_value" field is set Clears the value of the "double_value" field Field number for the "string_value" field. Gets whether the "string_value" field is set Clears the value of the "string_value" field Field number for the "aggregate_value" field. Gets whether the "aggregate_value" field is set Clears the value of the "aggregate_value" field Container for nested types declared in the UninterpretedOption message type. The name of the uninterpreted option. Each string represents a segment in a dot-separated name. is_extension is true iff a segment represents an extension (denoted with parentheses in options specs in .proto files). E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents "foo.(bar.baz).moo". Field number for the "name_part" field. Gets whether the "name_part" field is set Clears the value of the "name_part" field Field number for the "is_extension" field. Gets whether the "is_extension" field is set Clears the value of the "is_extension" field Encapsulates information about the original source file from which a FileDescriptorProto was generated. Field number for the "location" field. A Location identifies a piece of source code in a .proto file which corresponds to a particular definition. This information is intended to be useful to IDEs, code indexers, documentation generators, and similar tools. For example, say we have a file like: message Foo { optional string foo = 1; } Let's look at just the field definition: optional string foo = 1; ^ ^^ ^^ ^ ^^^ a bc de f ghi We have the following locations: span path represents [a,i) [ 4, 0, 2, 0 ] The whole field definition. [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). [c,d) [ 4, 0, 2, 0, 5 ] The type (string). [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). [g,h) [ 4, 0, 2, 0, 3 ] The number (1). Notes: - A location may refer to a repeated field itself (i.e. not to any particular index within it). This is used whenever a set of elements are logically enclosed in a single code segment. For example, an entire extend block (possibly containing multiple extension definitions) will have an outer location whose path refers to the "extensions" repeated field without an index. - Multiple locations may have the same path. This happens when a single logical declaration is spread out across multiple places. The most obvious example is the "extend" block again -- there may be multiple extend blocks in the same scope, each of which will have the same path. - A location's span is not always a subset of its parent's span. For example, the "extendee" of an extension declaration appears at the beginning of the "extend" block and is shared by all extensions within the block. - Just because a location's span is a subset of some other location's span does not mean that it is a descendant. For example, a "group" defines both a type and a field in a single declaration. Thus, the locations corresponding to the type and field and their components will overlap. - Code which tries to interpret locations should probably be designed to ignore those that it doesn't understand, as more types of locations could be recorded in the future. Container for nested types declared in the SourceCodeInfo message type. Field number for the "path" field. Identifies which part of the FileDescriptorProto was defined at this location. Each element is a field number or an index. They form a path from the root FileDescriptorProto to the place where the definition occurs. For example, this path: [ 4, 3, 2, 7, 1 ] refers to: file.message_type(3) // 4, 3 .field(7) // 2, 7 .name() // 1 This is because FileDescriptorProto.message_type has field number 4: repeated DescriptorProto message_type = 4; and DescriptorProto.field has field number 2: repeated FieldDescriptorProto field = 2; and FieldDescriptorProto.name has field number 1: optional string name = 1; Thus, the above path gives the location of a field name. If we removed the last element: [ 4, 3, 2, 7 ] this path refers to the whole field declaration (from the beginning of the label to the terminating semicolon). Field number for the "span" field. Always has exactly three or four elements: start line, start column, end line (optional, otherwise assumed same as start line), end column. These are packed into a single field for efficiency. Note that line and column numbers are zero-based -- typically you will want to add 1 to each before displaying to a user. Field number for the "leading_comments" field. If this SourceCodeInfo represents a complete declaration, these are any comments appearing before and after the declaration which appear to be attached to the declaration. A series of line comments appearing on consecutive lines, with no other tokens appearing on those lines, will be treated as a single comment. leading_detached_comments will keep paragraphs of comments that appear before (but not connected to) the current element. Each paragraph, separated by empty lines, will be one comment element in the repeated field. Only the comment content is provided; comment markers (e.g. //) are stripped out. For block comments, leading whitespace and an asterisk will be stripped from the beginning of each line other than the first. Newlines are included in the output. Examples: optional int32 foo = 1; // Comment attached to foo. // Comment attached to bar. optional int32 bar = 2; optional string baz = 3; // Comment attached to baz. // Another line attached to baz. // Comment attached to moo. // // Another line attached to moo. optional double moo = 4; // Detached comment for corge. This is not leading or trailing comments // to moo or corge because there are blank lines separating it from // both. // Detached comment for corge paragraph 2. optional string corge = 5; /* Block comment attached * to corge. Leading asterisks * will be removed. */ /* Block comment attached to * grault. */ optional int32 grault = 6; // ignored detached comments. Gets whether the "leading_comments" field is set Clears the value of the "leading_comments" field Field number for the "trailing_comments" field. Gets whether the "trailing_comments" field is set Clears the value of the "trailing_comments" field Field number for the "leading_detached_comments" field. Describes the relationship between generated code and its original source file. A GeneratedCodeInfo message is associated with only one generated source file, but may contain references to different source .proto files. Field number for the "annotation" field. An Annotation connects some span of text in generated code to an element of its generating .proto file. Container for nested types declared in the GeneratedCodeInfo message type. Field number for the "path" field. Identifies the element in the original source .proto file. This field is formatted the same as SourceCodeInfo.Location.path. Field number for the "source_file" field. Identifies the filesystem path to the original source .proto. Gets whether the "source_file" field is set Clears the value of the "source_file" field Field number for the "begin" field. Identifies the starting offset in bytes in the generated code that relates to the identified object. Gets whether the "begin" field is set Clears the value of the "begin" field Field number for the "end" field. Identifies the ending offset in bytes in the generated code that relates to the identified object. The end offset should be one past the last relevant byte (so the length of the text = end - begin). Gets whether the "end" field is set Clears the value of the "end" field Field number for the "semantic" field. Gets whether the "semantic" field is set Clears the value of the "semantic" field Container for nested types declared in the Annotation message type. Represents the identified object's effect on the element in the original .proto file. There is no effect or the effect is indescribable. The element is set or otherwise mutated. An alias to the element is returned. Base class for nearly all descriptors, providing common functionality. The index of this descriptor within its parent descriptor. This returns the index of this descriptor within its parent, for this descriptor's type. (There can be duplicate values for different types, e.g. one enum type with index 0 and one message type with index 0.) Returns the name of the entity (field, message etc) being described. The fully qualified name of the descriptor's target. The file this descriptor was declared in. The declaration information about the descriptor, or null if no declaration information is available for this descriptor. This information is typically only available for dynamically loaded descriptors, for example within a protoc plugin where the full descriptors, including source info, are passed to the code by protoc. Retrieves the list of nested descriptors corresponding to the given field number, if any. If the field is unknown or not a nested descriptor list, return null to terminate the search. The default implementation returns null. Provides additional information about the declaration of a descriptor, such as source location and comments. The descriptor this declaration relates to. The start line of the declaration within the source file. This value is 1-based. The start column of the declaration within the source file. This value is 1-based. // The end line of the declaration within the source file. This value is 1-based. The end column of the declaration within the source file. This value is 1-based, and exclusive. (The final character of the declaration is on the column before this value.) Comments appearing before the declaration. Never null, but may be empty. Multi-line comments are represented as a newline-separated string. Leading whitespace and the comment marker ("//") are removed from each line. Comments appearing after the declaration. Never null, but may be empty. Multi-line comments are represented as a newline-separated string. Leading whitespace and the comment marker ("//") are removed from each line. Comments appearing before the declaration, but separated from it by blank lines. Each string represents a newline-separated paragraph of comments. Leading whitespace and the comment marker ("//") are removed from each line. The list is never null, but may be empty. Likewise each element is never null, but may be empty. Contains lookup tables containing all the descriptors defined in a particular file. Finds a symbol of the given name within the pool. The type of symbol to look for Fully-qualified name to look up The symbol with the given name and type, or null if the symbol doesn't exist or has the wrong type Adds a package to the symbol tables. If a package by the same name already exists, that is fine, but if some other kind of symbol exists under the same name, an exception is thrown. If the package has multiple components, this also adds the parent package(s). Adds a symbol to the symbol table. The symbol already existed in the symbol table. Verifies that the descriptor's name is valid (i.e. it contains only letters, digits and underscores, and does not start with a digit). Returns the field with the given number in the given descriptor, or null if it can't be found. Adds a field to the fieldsByNumber table. A field with the same containing type and number already exists. Adds an enum value to the enumValuesByNumber table. If an enum value with the same type and number already exists, this method does nothing. (This is allowed; the first value defined with the number takes precedence.) Looks up a descriptor by name, relative to some other descriptor. The name may be fully-qualified (with a leading '.'), partially-qualified, or unqualified. C++-like name lookup semantics are used to search for the matching descriptor. This isn't heavily optimized, but it's only used during cross linking anyway. If it starts being used more widely, we should look at performance more carefully. Internal class containing utility methods when working with descriptors. Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert arrays. Converts the given array into a read-only list, applying the specified conversion to each input element. Thrown when building descriptors fails because the source DescriptorProtos are not valid. The full name of the descriptor where the error occurred. A human-readable description of the error. (The Message property is made up of the descriptor's name and this description.) Descriptor for an enum type in a .proto file. Returns a clone of the underlying describing this enum. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value. A protobuf representation of this enum descriptor. The brief name of the descriptor's target. The CLR type for this enum. For generated code, this will be a CLR enum type. If this is a nested type, get the outer descriptor, otherwise null. An unmodifiable list of defined value descriptors for this enum. Finds an enum value by number. If multiple enum values have the same number, this returns the first defined value with that number. If there is no value for the given number, this returns null. Finds an enum value by name. The unqualified name of the value (e.g. "FOO"). The value's descriptor, or null if not found. The (possibly empty) set of custom options for this enum. The EnumOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved. Gets a single value enum option for this descriptor Gets a repeated value enum option for this descriptor Descriptor for a single enum value within an enum in a .proto file. Returns a clone of the underlying describing this enum value. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value. A protobuf representation of this enum value descriptor. Returns the name of the enum value described by this object. Returns the number associated with this enum value. Returns the enum descriptor that this value is part of. The (possibly empty) set of custom options for this enum value. The EnumValueOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved. Gets a single value enum value option for this descriptor Gets a repeated value enum value option for this descriptor A collection to simplify retrieving the descriptors of extensions in a descriptor for a message Returns a readonly list of all the extensions defined in this type in the order they were defined in the source .proto file Returns a readonly list of all the extensions define in this type that extend the provided descriptor type in the order they were defined in the source .proto file Returns a readonly list of all the extensions define in this type that extend the provided descriptor type in ascending field order Base class for field accessors. Descriptor for a field or extension within a message in a .proto file. Get the field's containing message type, or null if it is a field defined at the top level of a file as an extension. Returns the oneof containing this field, or null if it is not part of a oneof. Returns the oneof containing this field if it's a "real" oneof, or null if either this field is not part of a oneof, or the oneof is synthetic. The effective JSON name for this field. This is usually the lower-camel-cased form of the field name, but can be overridden using the json_name option in the .proto file. The name of the property in the ContainingType.ClrType class. Indicates whether this field supports presence, either implicitly (e.g. due to it being a message type field) or explicitly via Has/Clear members. If this returns true, it is safe to call and on this field's accessor with a suitable message. Returns a clone of the underlying describing this field. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value. A protobuf representation of this field descriptor. An extension identifier for this field, or null if this field isn't an extension. The brief name of the descriptor's target. Returns the accessor for this field. While a describes the field, it does not provide any way of obtaining or changing the value of the field within a specific message; that is the responsibility of the accessor. In descriptors for generated code, the value returned by this property will be non-null for all regular fields. However, if a message containing a map field is introspected, the list of nested messages will include an auto-generated nested key/value pair message for the field. This is not represented in any generated type, and the value of the map field itself is represented by a dictionary in the reflection API. There are never instances of those "hidden" messages, so no accessor is provided and this property will return null. In dynamically loaded descriptors, the value returned by this property will current be null; if and when dynamic messages are supported, it will return a suitable accessor to work with them. Maps a field type as included in the .proto file to a FieldType. Returns true if this field is a repeated field; false otherwise. Returns true if this field is a required field; false otherwise. Returns true if this field is a map field; false otherwise. Returns true if this field is a packed, repeated field; false otherwise. Returns true if this field extends another message type; false otherwise. Returns the type of the field. Returns the field number declared in the proto file. Compares this descriptor with another one, ordering in "canonical" order which simply means ascending order by field number. must be a field of the same type, i.e. the of both fields must be the same. For enum fields, returns the field's type. For embedded message and group fields, returns the field's type. For extension fields, returns the extended type The (possibly empty) set of custom options for this field. The FieldOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved. Gets a single value field option for this descriptor Gets a repeated value field option for this descriptor Look up and cross-link all field types etc. Enumeration of all the possible field types. The double field type. The float field type. The int64 field type. The uint64 field type. The int32 field type. The fixed64 field type. The fixed32 field type. The bool field type. The string field type. The field type used for groups. The field type used for message fields. The bytes field type. The uint32 field type. The sfixed32 field type. The sfixed64 field type. The sint32 field type. The sint64 field type. The field type used for enum fields. The syntax of a .proto file Proto2 syntax Proto3 syntax An unknown declared syntax Describes a .proto file, including everything defined within. IDescriptor is implemented such that the File property returns this descriptor, and the FullName is the same as the Name. Computes the full name of a descriptor within this file, with an optional parent message. Extracts public dependencies from direct dependencies. This is a static method despite its first parameter, as the value we're in the middle of constructing is only used for exceptions. The descriptor in its protocol message representation. Returns a clone of the underlying describing this file. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value. A protobuf representation of this file descriptor. The syntax of the file The file name. The package as declared in the .proto file. This may or may not be equivalent to the .NET namespace of the generated classes. Unmodifiable list of top-level message types declared in this file. Unmodifiable list of top-level enum types declared in this file. Unmodifiable list of top-level services declared in this file. Unmodifiable list of top-level extensions declared in this file. Note that some extensions may be incomplete (FieldDescriptor.Extension may be null) if this descriptor was generated using a version of protoc that did not fully support extensions in C#. Unmodifiable list of this file's dependencies (imports). Unmodifiable list of this file's public dependencies (public imports). The original serialized binary form of this descriptor. Implementation of IDescriptor.FullName - just returns the same as Name. Implementation of IDescriptor.File - just returns this descriptor. Pool containing symbol descriptors. Finds a type (message, enum, service or extension) in the file by name. Does not find nested types. The unqualified type name to look for. The type of descriptor to look for The type's descriptor, or null if not found. Builds a FileDescriptor from its protocol buffer representation. The original serialized descriptor data. We have only limited proto2 support, so serializing FileDescriptorProto would not necessarily give us this. The protocol message form of the FileDescriptor. FileDescriptors corresponding to all of the file's dependencies, in the exact order listed in the .proto file. May be null, in which case it is treated as an empty array. Whether unknown dependencies are ignored (true) or cause an exception to be thrown (false). Details about generated code, for the purposes of reflection. If is not a valid descriptor. This can occur for a number of reasons, such as a field having an undefined type or because two messages were defined with the same name. Creates a descriptor for generated code. This method is only designed to be used by the results of generating code with protoc, which creates the appropriate dependencies etc. It has to be public because the generated code is "external", but should not be called directly by end users. Converts the given descriptor binary data into FileDescriptor objects. Note: reflection using the returned FileDescriptors is not currently supported. The binary file descriptor proto data. Must not be null, and any dependencies must come before the descriptor which depends on them. (If A depends on B, and B depends on C, then the descriptors must be presented in the order C, B, A.) This is compatible with the order in which protoc provides descriptors to plugins. The extension registry to use when parsing, or null if no extensions are required. The file descriptors corresponding to . Converts the given descriptor binary data into FileDescriptor objects. Note: reflection using the returned FileDescriptors is not currently supported. The binary file descriptor proto data. Must not be null, and any dependencies must come before the descriptor which depends on them. (If A depends on B, and B depends on C, then the descriptors must be presented in the order C, B, A.) This is compatible with the order in which protoc provides descriptors to plugins. The file descriptors corresponding to . Returns a that represents this instance. A that represents this instance. Returns the file descriptor for descriptor.proto. This is used for protos which take a direct dependency on descriptor.proto, typically for annotations. While descriptor.proto is a proto2 file, it is built into the Google.Protobuf runtime for reflection purposes. The messages are internal to the runtime as they would require proto2 semantics for full support, but the file descriptor is available via this property. The C# codegen in protoc automatically uses this property when it detects a dependency on descriptor.proto. The file descriptor for descriptor.proto. The (possibly empty) set of custom options for this file. The FileOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved. Gets a single value file option for this descriptor Gets a repeated value file option for this descriptor Performs initialization for the given generic type argument. This method is present for the sake of AOT compilers. It allows code (whether handwritten or generated) to make calls into the reflection machinery of this library to express an intention to use that type reflectively (e.g. for JSON parsing and formatting). The call itself does almost nothing, but AOT compilers attempting to determine which generic type arguments need to be handled will spot the code path and act accordingly. The type to force initialization for. Extra information provided by generated code when initializing a message or file descriptor. These are constructed as required, and are not long-lived. Hand-written code should never need to use this type. Irrelevant for file descriptors; the CLR type for the message for message descriptors. Irrelevant for file descriptors; the parser for message descriptors. Irrelevant for file descriptors; the CLR property names (in message descriptor field order) for fields in the message for message descriptors. The extensions defined within this file/message descriptor Irrelevant for file descriptors; the CLR property "base" names (in message descriptor oneof order) for oneofs in the message for message descriptors. It is expected that for a oneof name of "Foo", there will be a "FooCase" property and a "ClearFoo" method. The reflection information for types within this file/message descriptor. Elements may be null if there is no corresponding generated type, e.g. for map entry types. The CLR types for enums within this file/message descriptor. Creates a GeneratedClrTypeInfo for a message descriptor, with nested types, nested enums, the CLR type, property names and oneof names. Each array parameter may be null, to indicate a lack of values. The parameter order is designed to make it feasible to format the generated code readably. Creates a GeneratedClrTypeInfo for a message descriptor, with nested types, nested enums, the CLR type, property names and oneof names. Each array parameter may be null, to indicate a lack of values. The parameter order is designed to make it feasible to format the generated code readably. Creates a GeneratedClrTypeInfo for a file descriptor, with only types, enums, and extensions. Creates a GeneratedClrTypeInfo for a file descriptor, with only types and enums. Interface implemented by all descriptor types. Returns the name of the entity (message, field etc) being described. Returns the fully-qualified name of the entity being described. Returns the descriptor for the .proto file that this entity is part of. Allows fields to be reflectively accessed. Returns the descriptor associated with this field. Clears the field in the specified message. (For repeated fields, this clears the list.) Fetches the field value. For repeated values, this will be an implementation. For map values, this will be an implementation. Indicates whether the field in the specified message is set. For proto3 fields that aren't explicitly optional, this throws an Mutator for single "simple" fields only. Repeated fields are mutated by fetching the value and manipulating it as a list. Map fields are mutated by fetching the value and manipulating it as a dictionary. The field is not a "simple" field. Accessor for map fields. Describes a message type. The brief name of the descriptor's target. Returns a clone of the underlying describing this message. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value. A protobuf representation of this message descriptor. The CLR type used to represent message instances from this descriptor. The value returned by this property will be non-null for all regular fields. However, if a message containing a map field is introspected, the list of nested messages will include an auto-generated nested key/value pair message for the field. This is not represented in any generated type, so this property will return null in such cases. For wrapper types ( and the like), the type returned here will be the generated message type, not the native type used by reflection for fields of those types. Code using reflection should call to determine whether a message descriptor represents a wrapper type, and handle the result appropriately. A parser for this message type. As is not generic, this cannot be statically typed to the relevant type, but it should produce objects of a type compatible with . The value returned by this property will be non-null for all regular fields. However, if a message containing a map field is introspected, the list of nested messages will include an auto-generated nested key/value pair message for the field. No message parser object is created for such messages, so this property will return null in such cases. For wrapper types ( and the like), the parser returned here will be the generated message type, not the native type used by reflection for fields of those types. Code using reflection should call to determine whether a message descriptor represents a wrapper type, and handle the result appropriately. Returns whether this message is one of the "well known types" which may have runtime/protoc support. Returns whether this message is one of the "wrapper types" used for fields which represent primitive values with the addition of presence. If this is a nested type, get the outer descriptor, otherwise null. A collection of fields, which can be retrieved by name or field number. An unmodifiable list of extensions defined in this message's scope. Note that some extensions may be incomplete (FieldDescriptor.Extension may be null) if they are declared in a file generated using a version of protoc that did not fully support extensions in C#. An unmodifiable list of this message type's nested types. An unmodifiable list of this message type's enum types. An unmodifiable list of the "oneof" field collections in this message type. All "real" oneofs (where returns false) come before synthetic ones. The number of real "oneof" descriptors in this message type. Every element in with an index less than this will have a property value of false; every element with an index greater than or equal to this will have a property value of true. Finds a field by field name. The unqualified name of the field (e.g. "foo"). The field's descriptor, or null if not found. Finds a field by field number. The field number within this message type. The field's descriptor, or null if not found. Finds a nested descriptor by name. The is valid for fields, nested message types, oneofs and enums. The unqualified name of the descriptor, e.g. "Foo" The descriptor, or null if not found. The (possibly empty) set of custom options for this message. The MessageOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved. Gets a single value message option for this descriptor Gets a repeated value message option for this descriptor Looks up and cross-links all fields and nested types. A collection to simplify retrieving the field accessor for a particular field. Returns the fields in the message as an immutable list, in the order in which they are declared in the source .proto file. Returns the fields in the message as an immutable list, in ascending field number order. Field numbers need not be contiguous, so there is no direct mapping from the index in the list to the field number; to retrieve a field by field number, it is better to use the indexer. Returns a read-only dictionary mapping the field names in this message as they're available in the JSON representation to the field descriptors. For example, a field foo_bar in the message would result two entries, one with a key fooBar and one with a key foo_bar, both referring to the same field. Retrieves the descriptor for the field with the given number. Number of the field to retrieve the descriptor for The accessor for the given field The message descriptor does not contain a field with the given number Retrieves the descriptor for the field with the given name. Name of the field to retrieve the descriptor for The descriptor for the given field The message descriptor does not contain a field with the given name Describes a single method in a service. The service this method belongs to. The method's input type. The method's input type. Indicates if client streams multiple requests. Indicates if server streams multiple responses. The (possibly empty) set of custom options for this method. The MethodOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved. Gets a single value method option for this descriptor Gets a repeated value method option for this descriptor Returns a clone of the underlying describing this method. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value. A protobuf representation of this method descriptor. The brief name of the descriptor's target. Reflection access for a oneof, allowing clear and "get case" actions. Gets the descriptor for this oneof. The descriptor of the oneof. Clears the oneof in the specified message. Indicates which field in the oneof is set for specified message Describes a "oneof" field collection in a message type: a set of fields of which at most one can be set in any particular message. The brief name of the descriptor's target. Returns a clone of the underlying describing this oneof. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value. A protobuf representation of this oneof descriptor. Gets the message type containing this oneof. The message type containing this oneof. Gets the fields within this oneof, in declaration order. The fields within this oneof, in declaration order. Returns true if this oneof is a synthetic oneof containing a proto3 optional field; false otherwise. Gets an accessor for reflective access to the values associated with the oneof in a particular message. In descriptors for generated code, the value returned by this property will always be non-null. In dynamically loaded descriptors, the value returned by this property will current be null; if and when dynamic messages are supported, it will return a suitable accessor to work with them. The accessor used for reflective access. The (possibly empty) set of custom options for this oneof. The OneofOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved. Gets a single value oneof option for this descriptor Gets a repeated value oneof option for this descriptor Specifies the original name (in the .proto file) of a named element, such as an enum value. The name of the element in the .proto file. If the name is preferred in the .proto file. Constructs a new attribute instance for the given name. The name of the element in the .proto file. Represents a package in the symbol table. We use PackageDescriptors just as placeholders so that someone cannot define, say, a message type that has the same name as an existing package. The methods in this class are somewhat evil, and should not be tampered with lightly. Basically they allow the creation of relatively weakly typed delegates from MethodInfos which are more strongly typed. They do this by creating an appropriate strongly typed delegate from the MethodInfo, and then calling that within an anonymous method. Mind-bending stuff (at least to your humble narrator) but the resulting delegates are very fast compared with calling Invoke later on. Empty Type[] used when calling GetProperty to force property instead of indexer fetching. Creates a delegate which will cast the argument to the type that declares the method, call the method on it, then convert the result to object. The method to create a delegate for, which must be declared in an IMessage implementation. Creates a delegate which will cast the argument to the type that declares the method, call the method on it, then convert the result to the specified type. The method is expected to actually return an enum (because of where we're calling it - for oneof cases). Sometimes that means we need some extra work to perform conversions. The method to create a delegate for, which must be declared in an IMessage implementation. Creates a delegate which will execute the given method after casting the first argument to the type that declares the method, and the second argument to the first parameter type of the method. The method to create a delegate for, which must be declared in an IMessage implementation. Creates a delegate which will execute the given method after casting the first argument to type that declares the method. The method to create a delegate for, which must be declared in an IMessage implementation. Creates a delegate which will execute the given method after casting the first argument to the type that declares the method, and the second argument to the first parameter type of the method. Creates a reflection helper for the given type arguments. Currently these are created on demand rather than cached; this will be "busy" when initially loading a message's descriptor, but after that they can be garbage collected. We could cache them by type if that proves to be important, but creating an object is pretty cheap. Accessor for repeated fields. Describes a service type. The brief name of the descriptor's target. Returns a clone of the underlying describing this service. Note that a copy is taken every time this method is called, so clients using it frequently (and not modifying it) may want to cache the returned value. A protobuf representation of this service descriptor. An unmodifiable list of methods in this service. Finds a method by name. The unqualified name of the method (e.g. "Foo"). The method's descriptor, or null if not found. The (possibly empty) set of custom options for this service. The ServiceOptions, defined in descriptor.proto. If the options message is not present (i.e. there are no options), null is returned. Custom options can be retrieved as extensions of the returned message. NOTE: A defensive copy is created each time this property is retrieved. Gets a single value service option for this descriptor Gets a repeated value service option for this descriptor Accessor for single fields. An immutable registry of types which can be looked up by their full name. An empty type registry, containing no types. Attempts to find a message descriptor by its full name. The full name of the message, which is the dot-separated combination of package, containing messages and message name The message descriptor corresponding to or null if there is no such message descriptor. Creates a type registry from the specified set of file descriptors. This is a convenience overload for to allow calls such as TypeRegistry.FromFiles(descriptor1, descriptor2). The set of files to include in the registry. Must not contain null values. A type registry for the given files. Creates a type registry from the specified set of file descriptors. All message types within all the specified files are added to the registry, and the dependencies of the specified files are also added, recursively. The set of files to include in the registry. Must not contain null values. A type registry for the given files. Creates a type registry from the file descriptor parents of the specified set of message descriptors. This is a convenience overload for to allow calls such as TypeRegistry.FromFiles(descriptor1, descriptor2). The set of message descriptors to use to identify file descriptors to include in the registry. Must not contain null values. A type registry for the given files. Creates a type registry from the file descriptor parents of the specified set of message descriptors. The specified message descriptors are only used to identify their file descriptors; the returned registry contains all the types within the file descriptors which contain the specified message descriptors (and the dependencies of those files), not just the specified messages. The set of message descriptors to use to identify file descriptors to include in the registry. Must not contain null values. A type registry for the given files. Builder class which isn't exposed, but acts as a convenient alternative to passing round two dictionaries in recursive calls. Abstraction for reading from a stream / read only sequence. Parsing from the buffer is a loop of reading from current buffer / refreshing the buffer once done. Initialize an instance with a coded input stream. This approach is faster than using a constructor because the instance to initialize is passed by reference and we can write directly into it without copying. Initialize an instance with a read only sequence. This approach is faster than using a constructor because the instance to initialize is passed by reference and we can write directly into it without copying. Sets currentLimit to (current position) + byteLimit. This is called when descending into a length-delimited embedded message. The previous limit is returned. The old limit. Discards the current limit, returning the previous limit. Returns whether or not all the data before the limit has been read. Returns true if the stream has reached the end of the input. This is the case if either the end of the underlying input source has been reached or the stream has reached a limit created using PushLimit. Represents a single field in an UnknownFieldSet. An UnknownField consists of four lists of values. The lists correspond to the four "wire types" used in the protocol buffer binary format. Normally, only one of the four lists will contain any values, since it is impossible to define a valid message type that declares two different types for the same field number. However, the code is designed to allow for the case where the same unknown field number is encountered using multiple different wire types. Creates a new UnknownField. Checks if two unknown field are equal. Get the hash code of the unknown field. Serializes the field, including the field number, and writes it to The unknown field number. The write context to write to. Computes the number of bytes required to encode this field, including field number. Merge the values in into this field. For each list of values, 's values are append to the ones in this field. Returns a new list containing all of the given specified values from both the and lists. If is null and is null or empty, null is returned. Otherwise, either a new list is created (if is null) or the elements of are added to . Adds a varint value. Adds a fixed32 value. Adds a fixed64 value. Adds a length-delimited value. Adds to the , creating a new list if is null. The list is returned - either the original reference or the new list. Used to keep track of fields which were seen when parsing a protocol message but whose field numbers or types are unrecognized. This most frequently occurs when new fields are added to a message type and then messages containing those fields are read by old software that was built before the new types were added. Most users will never need to use this class directly. Creates a new UnknownFieldSet. Checks whether or not the given field number is present in the set. Serializes the set and writes it to . Serializes the set and writes it to . Gets the number of bytes required to encode this set. Checks if two unknown field sets are equal. Gets the unknown field set's hash code. Adds a field to the set. If a field with the same number already exists, it is replaced. Parse a single field from and merge it into this set. The parse context from which to read the field false if the tag is an "end group" tag, true otherwise Create a new UnknownFieldSet if unknownFields is null. Parse a single field from and merge it into unknownFields. If is configured to discard unknown fields, will be returned as-is and the field will be skipped. The UnknownFieldSet which need to be merged The coded input stream containing the field The merged UnknownFieldSet Create a new UnknownFieldSet if unknownFields is null. Parse a single field from and merge it into unknownFields. If is configured to discard unknown fields, will be returned as-is and the field will be skipped. The UnknownFieldSet which need to be merged The parse context from which to read the field The merged UnknownFieldSet Merges the fields from into this set. If a field number exists in both sets, the values in will be appended to the values in this set. Created a new UnknownFieldSet to if needed and merges the fields from into the first set. If a field number exists in both sets, the values in will be appended to the values in this set. Adds a field to the unknown field set. If a field with the same number already exists, the two are merged. Clone an unknown field set from . Provides a number of unsafe byte operations to be used by advanced applications with high performance requirements. These methods are referred to as "unsafe" due to the fact that they potentially expose the backing buffer of a to the application. The methods in this class should only be called if it is guaranteed that the buffer backing the will never change! Mutation of a can lead to unexpected and undesirable consequences in your application, and will likely be difficult to debug. Proceed with caution! This can have a number of significant side affects that have spooky-action-at-a-distance-like behavior. In particular, if the bytes value changes out from under a Protocol Buffer: serialization may throw serialization may succeed but the wrong bytes may be written out objects that are normally immutable (such as ByteString) are no longer immutable hashCode may be incorrect Constructs a new from the given bytes. The bytes are not copied, and must not be modified while the is in use. This API is experimental and subject to change. Holder for reflection information generated from google/protobuf/any.proto File descriptor for google/protobuf/any.proto `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } // or ... if (any.isSameTypeAs(Foo.getDefaultInstance())) { foo = any.unpack(Foo.getDefaultInstance()); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example "foo.bar.com/x/y.z" will yield type name "y.z". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { "@type": "type.googleapis.com/google.profile.Person", "firstName": <string>, "lastName": <string> } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } Field number for the "type_url" field. A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one "/" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading "." is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. Field number for the "value" field. Must be a valid serialized protocol buffer of the above specified type. Retrieves the type name for a type URL, matching the of the packed message type. This is always just the last part of the URL, after the final slash. No validation of anything before the trailing slash is performed. If the type URL does not include a slash, an empty string is returned rather than an exception being thrown; this won't match any types, and the calling code is probably in a better position to give a meaningful error. There is no handling of fragments or queries at the moment. The URL to extract the type name from The type name Returns a bool indictating whether this Any message is of the target message type The descriptor of the message type true if the type name matches the descriptor's full name or false otherwise Unpacks the content of this Any message into the target message type, which must match the type URL within this Any message. The type of message to unpack the content into. The unpacked message. The target message type doesn't match the type URL in this message Attempts to unpack the content of this Any message into the target message type, if it matches the type URL within this Any message. The type of message to attempt to unpack the content into. true if the message was successfully unpacked; false if the type name didn't match Attempts to unpack the content of this Any message into one of the message types in the given type registry, based on the type URL. The type registry to consult for messages. The unpacked message, or null if no matching message was found. Packs the specified message into an Any message using a type URL prefix of "type.googleapis.com". The message to pack. An Any message with the content and type URL of . Packs the specified message into an Any message using the specified type URL prefix. The message to pack. The prefix for the type URL. An Any message with the content and type URL of . Holder for reflection information generated from google/protobuf/api.proto File descriptor for google/protobuf/api.proto Api is a light-weight descriptor for an API Interface. Interfaces are also described as "protocol buffer services" in some contexts, such as by the "service" keyword in a .proto file, but they are different from API Services, which represent a concrete implementation of an interface as opposed to simply a description of methods and bindings. They are also sometimes simply referred to as "APIs" in other contexts, such as the name of this message itself. See https://cloud.google.com/apis/design/glossary for detailed terminology. Field number for the "name" field. The fully qualified name of this interface, including package name followed by the interface's simple name. Field number for the "methods" field. The methods of this interface, in unspecified order. Field number for the "options" field. Any metadata attached to the interface. Field number for the "version" field. A version string for this interface. If specified, must have the form `major-version.minor-version`, as in `1.10`. If the minor version is omitted, it defaults to zero. If the entire version field is empty, the major version is derived from the package name, as outlined below. If the field is not empty, the version in the package name will be verified to be consistent with what is provided here. The versioning schema uses [semantic versioning](http://semver.org) where the major version number indicates a breaking change and the minor version an additive, non-breaking change. Both version numbers are signals to users what to expect from different versions, and should be carefully chosen based on the product plan. The major version is also reflected in the package name of the interface, which must end in `v<major-version>`, as in `google.feature.v1`. For major versions 0 and 1, the suffix can be omitted. Zero major versions must only be used for experimental, non-GA interfaces. Field number for the "source_context" field. Source context for the protocol buffer service represented by this message. Field number for the "mixins" field. Included interfaces. See [Mixin][]. Field number for the "syntax" field. The source syntax of the service. Method represents a method of an API interface. Field number for the "name" field. The simple name of this method. Field number for the "request_type_url" field. A URL of the input message type. Field number for the "request_streaming" field. If true, the request is streamed. Field number for the "response_type_url" field. The URL of the output message type. Field number for the "response_streaming" field. If true, the response is streamed. Field number for the "options" field. Any metadata attached to the method. Field number for the "syntax" field. The source syntax of this method. Declares an API Interface to be included in this interface. The including interface must redeclare all the methods from the included interface, but documentation and options are inherited as follows: - If after comment and whitespace stripping, the documentation string of the redeclared method is empty, it will be inherited from the original method. - Each annotation belonging to the service config (http, visibility) which is not set in the redeclared method will be inherited. - If an http annotation is inherited, the path pattern will be modified as follows. Any version prefix will be replaced by the version of the including interface plus the [root][] path if specified. Example of a simple mixin: package google.acl.v1; service AccessControl { // Get the underlying ACL object. rpc GetAcl(GetAclRequest) returns (Acl) { option (google.api.http).get = "/v1/{resource=**}:getAcl"; } } package google.storage.v2; service Storage { rpc GetAcl(GetAclRequest) returns (Acl); // Get a data record. rpc GetData(GetDataRequest) returns (Data) { option (google.api.http).get = "/v2/{resource=**}"; } } Example of a mixin configuration: apis: - name: google.storage.v2.Storage mixins: - name: google.acl.v1.AccessControl The mixin construct implies that all methods in `AccessControl` are also declared with same name and request/response types in `Storage`. A documentation generator or annotation processor will see the effective `Storage.GetAcl` method after inherting documentation and annotations as follows: service Storage { // Get the underlying ACL object. rpc GetAcl(GetAclRequest) returns (Acl) { option (google.api.http).get = "/v2/{resource=**}:getAcl"; } ... } Note how the version in the path pattern changed from `v1` to `v2`. If the `root` field in the mixin is specified, it should be a relative path under which inherited HTTP paths are placed. Example: apis: - name: google.storage.v2.Storage mixins: - name: google.acl.v1.AccessControl root: acls This implies the following inherited HTTP annotation: service Storage { // Get the underlying ACL object. rpc GetAcl(GetAclRequest) returns (Acl) { option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; } ... } Field number for the "name" field. The fully qualified name of the interface which is included. Field number for the "root" field. If non-empty specifies a path under which inherited HTTP paths are rooted. Holder for reflection information generated from google/protobuf/duration.proto File descriptor for google/protobuf/duration.proto A Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". It is related to Timestamp in that the difference between two Timestamp values is a Duration and it can be added or subtracted from a Timestamp. Range is approximately +-10,000 years. # Examples Example 1: Compute Duration from two Timestamps in pseudo code. Timestamp start = ...; Timestamp end = ...; Duration duration = ...; duration.seconds = end.seconds - start.seconds; duration.nanos = end.nanos - start.nanos; if (duration.seconds < 0 && duration.nanos > 0) { duration.seconds += 1; duration.nanos -= 1000000000; } else if (duration.seconds > 0 && duration.nanos < 0) { duration.seconds -= 1; duration.nanos += 1000000000; } Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. Timestamp start = ...; Duration duration = ...; Timestamp end = ...; end.seconds = start.seconds + duration.seconds; end.nanos = start.nanos + duration.nanos; if (end.nanos < 0) { end.seconds -= 1; end.nanos += 1000000000; } else if (end.nanos >= 1000000000) { end.seconds += 1; end.nanos -= 1000000000; } Example 3: Compute Duration from datetime.timedelta in Python. td = datetime.timedelta(days=3, minutes=10) duration = Duration() duration.FromTimedelta(td) # JSON Mapping In JSON format, the Duration type is encoded as a string rather than an object, where the string ends in the suffix "s" (indicating seconds) and is preceded by the number of seconds, with nanoseconds expressed as fractional seconds. For example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should be expressed in JSON format as "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON format as "3.000001s". Field number for the "seconds" field. Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years Field number for the "nanos" field. Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 `seconds` field and a positive or negative `nanos` field. For durations of one second or more, a non-zero value for the `nanos` field must be of the same sign as the `seconds` field. Must be from -999,999,999 to +999,999,999 inclusive. The number of nanoseconds in a second. The number of nanoseconds in a BCL tick (as used by and ). The maximum permitted number of seconds. The minimum permitted number of seconds. Converts this to a . If the duration is not a precise number of ticks, it is truncated towards 0. The value of this duration, as a TimeSpan. This value isn't a valid normalized duration, as described in the documentation. Converts the given to a . The TimeSpan to convert. The value of the given TimeSpan, as a Duration. Returns the result of negating the duration. For example, the negation of 5 minutes is -5 minutes. The duration to negate. Must not be null. The negated value of this duration. Adds the two specified values together. The first value to add. Must not be null. The second value to add. Must not be null. Subtracts one from another. The duration to subtract from. Must not be null. The duration to subtract. Must not be null. The difference between the two specified durations. Creates a duration with the normalized values from the given number of seconds and nanoseconds, conforming with the description in the proto file. Converts a duration specified in seconds/nanoseconds to a string. If the value is a normalized duration in the range described in duration.proto, is ignored. Otherwise, if the parameter is true, a JSON object with a warning is returned; if it is false, an is thrown. Seconds portion of the duration. Nanoseconds portion of the duration. Determines the handling of non-normalized values The represented duration is invalid, and is false. Returns a string representation of this for diagnostic purposes. Normally the returned value will be a JSON string value (including leading and trailing quotes) but when the value is non-normalized or out of range, a JSON object representation will be returned instead, including a warning. This is to avoid exceptions being thrown when trying to diagnose problems - the regular JSON formatter will still throw an exception for non-normalized values. A string representation of this value. Appends a number of nanoseconds to a StringBuilder. Either 0 digits are added (in which case no "." is appended), or 3 6 or 9 digits. This is internal for use in Timestamp as well as Duration. Given another duration, returns 0 if the durations are equivalent, -1 if this duration is shorter than the other, and 1 otherwise. This method expects that both durations are normalized; that is, that the values of and are within the documented bounds. If either value is not normalized, the results of this method are unspecified. The duration to compare with this object. An integer indicating whether this duration is shorter or longer than . Holder for reflection information generated from google/protobuf/empty.proto File descriptor for google/protobuf/empty.proto A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } Holder for reflection information generated from google/protobuf/field_mask.proto File descriptor for google/protobuf/field_mask.proto `FieldMask` represents a set of symbolic field paths, for example: paths: "f.a" paths: "f.b.d" Here `f` represents a field in some root message, `a` and `b` fields in the message found in `f`, and `d` a field found in the message in `f.b`. Field masks are used to specify a subset of fields that should be returned by a get operation or modified by an update operation. Field masks also have a custom JSON encoding (see below). # Field Masks in Projections When used in the context of a projection, a response message or sub-message is filtered by the API to only contain those fields as specified in the mask. For example, if the mask in the previous example is applied to a response message as follows: f { a : 22 b { d : 1 x : 2 } y : 13 } z: 8 The result will not contain specific values for fields x,y and z (their value will be set to the default, and omitted in proto text output): f { a : 22 b { d : 1 } } A repeated field is not allowed except at the last position of a paths string. If a FieldMask object is not present in a get operation, the operation applies to all fields (as if a FieldMask of all fields had been specified). Note that a field mask does not necessarily apply to the top-level response message. In case of a REST get operation, the field mask applies directly to the response, but in case of a REST list operation, the mask instead applies to each individual message in the returned resource list. In case of a REST custom method, other definitions may be used. Where the mask applies will be clearly documented together with its declaration in the API. In any case, the effect on the returned resource/resources is required behavior for APIs. # Field Masks in Update Operations A field mask in update operations specifies which fields of the targeted resource are going to be updated. The API is required to only change the values of the fields as specified in the mask and leave the others untouched. If a resource is passed in to describe the updated values, the API ignores the values of all fields not covered by the mask. If a repeated field is specified for an update operation, new values will be appended to the existing repeated field in the target resource. Note that a repeated field is only allowed in the last position of a `paths` string. If a sub-message is specified in the last position of the field mask for an update operation, then new value will be merged into the existing sub-message in the target resource. For example, given the target message: f { b { d: 1 x: 2 } c: [1] } And an update message: f { b { d: 10 } c: [2] } then if the field mask is: paths: ["f.b", "f.c"] then the result will be: f { b { d: 10 x: 2 } c: [1, 2] } An implementation may provide options to override this default behavior for repeated and message fields. In order to reset a field's value to the default, the field must be in the mask and set to the default value in the provided resource. Hence, in order to reset all fields of a resource, provide a default instance of the resource and set all fields in the mask, or do not provide a mask as described below. If a field mask is not present on update, the operation applies to all fields (as if a field mask of all fields has been specified). Note that in the presence of schema evolution, this may mean that fields the client does not know and has therefore not filled into the request will be reset to their default. If this is unwanted behavior, a specific service may require a client to always specify a field mask, producing an error if not. As with get operations, the location of the resource which describes the updated values in the request message depends on the operation kind. In any case, the effect of the field mask is required to be honored by the API. ## Considerations for HTTP REST The HTTP kind of an update operation which uses a field mask must be set to PATCH instead of PUT in order to satisfy HTTP semantics (PUT must only be used for full updates). # JSON Encoding of Field Masks In JSON, a field mask is encoded as a single string where paths are separated by a comma. Fields name in each path are converted to/from lower-camel naming conventions. As an example, consider the following message declarations: message Profile { User user = 1; Photo photo = 2; } message User { string display_name = 1; string address = 2; } In proto a field mask for `Profile` may look as such: mask { paths: "user.display_name" paths: "photo" } In JSON, the same mask is represented as below: { mask: "user.displayName,photo" } # Field Masks and Oneof Fields Field masks treat fields in oneofs just as regular fields. Consider the following message: message SampleMessage { oneof test_oneof { string name = 4; SubMessage sub_message = 9; } } The field mask can be: mask { paths: "name" } Or: mask { paths: "sub_message" } Note that oneof type names ("test_oneof" in this case) cannot be used in paths. ## Field Mask Verification The implementation of any API method which has a FieldMask type field in the request should verify the included field paths, and return an `INVALID_ARGUMENT` error if any path is unmappable. Field number for the "paths" field. The set of field mask paths. Converts a field mask specified by paths to a string. If the value is a normalized duration in the range described in field_mask.proto, is ignored. Otherwise, if the parameter is true, a JSON object with a warning is returned; if it is false, an is thrown. Paths in the field mask Determines the handling of non-normalized values The represented field mask is invalid, and is false. Returns a string representation of this for diagnostic purposes. Normally the returned value will be a JSON string value (including leading and trailing quotes) but when the value is non-normalized or out of range, a JSON object representation will be returned instead, including a warning. This is to avoid exceptions being thrown when trying to diagnose problems - the regular JSON formatter will still throw an exception for non-normalized values. A string representation of this value. Parses from a string to a FieldMask. Parses from a string to a FieldMask and validates all field paths. The type to validate the field paths against. Constructs a FieldMask for a list of field paths in a certain type. The type to validate the field paths against. Constructs a FieldMask from the passed field numbers. The type to validate the field paths against. Constructs a FieldMask from the passed field numbers. The type to validate the field paths against. Checks whether the given path is valid for a field mask. true if the path is valid; false otherwise Checks whether paths in a given fields mask are valid. The type to validate the field paths against. Checks whether paths in a given fields mask are valid. Checks whether a given field path is valid. The type to validate the field paths against. Checks whether paths in a given fields mask are valid. Converts this FieldMask to its canonical form. In the canonical form of a FieldMask, all field paths are sorted alphabetically and redundant field paths are removed. Creates a union of two or more FieldMasks. Calculates the intersection of two FieldMasks. Merges fields specified by this FieldMask from one message to another with the specified merge options. Merges fields specified by this FieldMask from one message to another. Options to customize merging behavior. Whether to replace message fields(i.e., discard existing content in destination message fields) when merging. Default behavior is to merge the source message field into the destination message field. Whether to replace repeated fields (i.e., discard existing content in destination repeated fields) when merging. Default behavior is to append elements from source repeated field to the destination repeated field. Whether to replace primitive (non-repeated and non-message) fields in destination message fields with the source primitive fields (i.e., if the field is set in the source, the value is copied to the destination; if the field is unset in the source, the field is cleared from the destination) when merging. Default behavior is to always set the value of the source primitive field to the destination primitive field, and if the source field is unset, the default value of the source field is copied to the destination. Holder for reflection information generated from google/protobuf/source_context.proto File descriptor for google/protobuf/source_context.proto `SourceContext` represents information about the source of a protobuf element, like the file in which it is defined. Field number for the "file_name" field. The path-qualified name of the .proto file that contained the associated protobuf element. For example: `"google/protobuf/source_context.proto"`. Holder for reflection information generated from google/protobuf/struct.proto File descriptor for google/protobuf/struct.proto `NullValue` is a singleton enumeration to represent the null value for the `Value` type union. The JSON representation for `NullValue` is JSON `null`. Null value. `Struct` represents a structured data value, consisting of fields which map to dynamically typed values. In some languages, `Struct` might be supported by a native representation. For example, in scripting languages like JS a struct is represented as an object. The details of that representation are described together with the proto support for the language. The JSON representation for `Struct` is JSON object. Field number for the "fields" field. Unordered map of dynamically typed values. `Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a list of values. A producer of value is expected to set one of these variants. Absence of any variant indicates an error. The JSON representation for `Value` is JSON value. Field number for the "null_value" field. Represents a null value. Gets whether the "null_value" field is set Clears the value of the oneof if it's currently set to "null_value" Field number for the "number_value" field. Represents a double value. Gets whether the "number_value" field is set Clears the value of the oneof if it's currently set to "number_value" Field number for the "string_value" field. Represents a string value. Gets whether the "string_value" field is set Clears the value of the oneof if it's currently set to "string_value" Field number for the "bool_value" field. Represents a boolean value. Gets whether the "bool_value" field is set Clears the value of the oneof if it's currently set to "bool_value" Field number for the "struct_value" field. Represents a structured value. Field number for the "list_value" field. Represents a repeated `Value`. Enum of possible cases for the "kind" oneof. Convenience method to create a Value message with a string value. Value to set for the StringValue property. A newly-created Value message with the given value. Convenience method to create a Value message with a number value. Value to set for the NumberValue property. A newly-created Value message with the given value. Convenience method to create a Value message with a Boolean value. Value to set for the BoolValue property. A newly-created Value message with the given value. Convenience method to create a Value message with a null initial value. A newly-created Value message a null initial value. Convenience method to create a Value message with an initial list of values. The values provided are not cloned; the references are copied directly. A newly-created Value message an initial list value. Convenience method to create a Value message with an initial struct value The value provided is not cloned; the reference is copied directly. A newly-created Value message an initial struct value. `ListValue` is a wrapper around a repeated field of values. The JSON representation for `ListValue` is JSON array. Field number for the "values" field. Repeated field of dynamically typed values. Extension methods on BCL time-related types, converting to protobuf types. Converts the given to a . The date and time to convert to a timestamp. The value has a other than Utc. The converted timestamp. Converts the given to a The offset is taken into consideration when converting the value (so the same instant in time is represented) but is not a separate part of the resulting value. In other words, there is no roundtrip operation to retrieve the original DateTimeOffset. The date and time (with UTC offset) to convert to a timestamp. The converted timestamp. Converts the given to a . The time span to convert. The converted duration. Holder for reflection information generated from google/protobuf/timestamp.proto File descriptor for google/protobuf/timestamp.proto A Timestamp represents a point in time independent of any time zone or local calendar, encoded as a count of seconds and fractions of seconds at nanosecond resolution. The count is relative to an epoch at UTC midnight on January 1, 1970, in the proleptic Gregorian calendar which extends the Gregorian calendar backwards to year one. All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap second table is needed for interpretation, using a [24-hour linear smear](https://developers.google.com/time/smear). The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. # Examples Example 1: Compute Timestamp from POSIX `time()`. Timestamp timestamp; timestamp.set_seconds(time(NULL)); timestamp.set_nanos(0); Example 2: Compute Timestamp from POSIX `gettimeofday()`. struct timeval tv; gettimeofday(&tv, NULL); Timestamp timestamp; timestamp.set_seconds(tv.tv_sec); timestamp.set_nanos(tv.tv_usec * 1000); Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. FILETIME ft; GetSystemTimeAsFileTime(&ft); UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. Timestamp timestamp; timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. long millis = System.currentTimeMillis(); Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) .setNanos((int) ((millis % 1000) * 1000000)).build(); Example 5: Compute Timestamp from Java `Instant.now()`. Instant now = Instant.now(); Timestamp timestamp = Timestamp.newBuilder().setSeconds(now.getEpochSecond()) .setNanos(now.getNano()).build(); Example 6: Compute Timestamp from current time in Python. timestamp = Timestamp() timestamp.GetCurrentTime() # JSON Mapping In JSON format, the Timestamp type is encoded as a string in the [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" where {year} is always expressed using four digits while {month}, {day}, {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone is required. A proto3 JSON serializer should always use UTC (as indicated by "Z") when printing the Timestamp type and a proto3 JSON parser should be able to accept both UTC and other timezones (as indicated by an offset). For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past 01:30 UTC on January 15, 2017. In JavaScript, one can convert a Date object to this format using the standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) method. In Python, a standard `datetime.datetime` object can be converted to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() ) to obtain a formatter capable of generating timestamps in this format. Field number for the "seconds" field. Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive. Field number for the "nanos" field. Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive. Returns the difference between one and another, as a . The timestamp to subtract from. Must not be null. The timestamp to subtract. Must not be null. The difference between the two specified timestamps. Adds a to a , to obtain another Timestamp. The timestamp to add the duration to. Must not be null. The duration to add. Must not be null. The result of adding the duration to the timestamp. Subtracts a from a , to obtain another Timestamp. The timestamp to subtract the duration from. Must not be null. The duration to subtract. The result of subtracting the duration from the timestamp. Converts this timestamp into a . The resulting DateTime will always have a Kind of Utc. If the timestamp is not a precise number of ticks, it will be truncated towards the start of time. For example, a timestamp with a value of 99 will result in a value precisely on a second. This timestamp as a DateTime. The timestamp contains invalid values; either it is incorrectly normalized or is outside the valid range. Converts this timestamp into a . The resulting DateTimeOffset will always have an Offset of zero. If the timestamp is not a precise number of ticks, it will be truncated towards the start of time. For example, a timestamp with a value of 99 will result in a value precisely on a second. This timestamp as a DateTimeOffset. The timestamp contains invalid values; either it is incorrectly normalized or is outside the valid range. Converts the specified to a . The Kind of is not DateTimeKind.Utc. The converted timestamp. Converts the given to a The offset is taken into consideration when converting the value (so the same instant in time is represented) but is not a separate part of the resulting value. In other words, there is no roundtrip operation to retrieve the original DateTimeOffset. The date and time (with UTC offset) to convert to a timestamp. The converted timestamp. Converts a timestamp specified in seconds/nanoseconds to a string. If the value is a normalized duration in the range described in timestamp.proto, is ignored. Otherwise, if the parameter is true, a JSON object with a warning is returned; if it is false, an is thrown. Seconds portion of the duration. Nanoseconds portion of the duration. Determines the handling of non-normalized values The represented duration is invalid, and is false. Given another timestamp, returns 0 if the timestamps are equivalent, -1 if this timestamp precedes the other, and 1 otherwise Make sure the timestamps are normalized. Comparing non-normalized timestamps is not specified and may give unexpected results. Timestamp to compare an integer indicating whether this timestamp precedes or follows the other Compares two timestamps and returns whether the first is less than (chronologically precedes) the second Make sure the timestamps are normalized. Comparing non-normalized timestamps is not specified and may give unexpected results. true if a precedes b Compares two timestamps and returns whether the first is greater than (chronologically follows) the second Make sure the timestamps are normalized. Comparing non-normalized timestamps is not specified and may give unexpected results. true if a follows b Compares two timestamps and returns whether the first is less than (chronologically precedes) the second Make sure the timestamps are normalized. Comparing non-normalized timestamps is not specified and may give unexpected results. true if a precedes b Compares two timestamps and returns whether the first is greater than (chronologically follows) the second Make sure the timestamps are normalized. Comparing non-normalized timestamps is not specified and may give unexpected results. true if a follows b Returns whether two timestamps are equivalent Make sure the timestamps are normalized. Comparing non-normalized timestamps is not specified and may give unexpected results. true if the two timestamps refer to the same nanosecond Returns whether two timestamps differ Make sure the timestamps are normalized. Comparing non-normalized timestamps is not specified and may give unexpected results. true if the two timestamps differ Returns a string representation of this for diagnostic purposes. Normally the returned value will be a JSON string value (including leading and trailing quotes) but when the value is non-normalized or out of range, a JSON object representation will be returned instead, including a warning. This is to avoid exceptions being thrown when trying to diagnose problems - the regular JSON formatter will still throw an exception for non-normalized values. A string representation of this value. Holder for reflection information generated from google/protobuf/type.proto File descriptor for google/protobuf/type.proto The syntax in which a protocol buffer element is defined. Syntax `proto2`. Syntax `proto3`. Syntax `editions`. A protocol buffer message type. Field number for the "name" field. The fully qualified message name. Field number for the "fields" field. The list of fields. Field number for the "oneofs" field. The list of types appearing in `oneof` definitions in this type. Field number for the "options" field. The protocol buffer options. Field number for the "source_context" field. The source context. Field number for the "syntax" field. The source syntax. Field number for the "edition" field. The source edition string, only valid when syntax is SYNTAX_EDITIONS. A single field of a message type. Field number for the "kind" field. The field type. Field number for the "cardinality" field. The field cardinality. Field number for the "number" field. The field number. Field number for the "name" field. The field name. Field number for the "type_url" field. The field type URL, without the scheme, for message or enumeration types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. Field number for the "oneof_index" field. The index of the field type in `Type.oneofs`, for message or enumeration types. The first type has index 1; zero means the type is not in the list. Field number for the "packed" field. Whether to use alternative packed wire representation. Field number for the "options" field. The protocol buffer options. Field number for the "json_name" field. The field JSON name. Field number for the "default_value" field. The string value of the default value of this field. Proto2 syntax only. Container for nested types declared in the Field message type. Basic field types. Field type unknown. Field type double. Field type float. Field type int64. Field type uint64. Field type int32. Field type fixed64. Field type fixed32. Field type bool. Field type string. Field type group. Proto2 syntax only, and deprecated. Field type message. Field type bytes. Field type uint32. Field type enum. Field type sfixed32. Field type sfixed64. Field type sint32. Field type sint64. Whether a field is optional, required, or repeated. For fields with unknown cardinality. For optional fields. For required fields. Proto2 syntax only. For repeated fields. Enum type definition. Field number for the "name" field. Enum type name. Field number for the "enumvalue" field. Enum value definitions. Field number for the "options" field. Protocol buffer options. Field number for the "source_context" field. The source context. Field number for the "syntax" field. The source syntax. Field number for the "edition" field. The source edition string, only valid when syntax is SYNTAX_EDITIONS. Enum value definition. Field number for the "name" field. Enum value name. Field number for the "number" field. Enum value number. Field number for the "options" field. Protocol buffer options. A protocol buffer option, which can be attached to a message, field, enumeration, etc. Field number for the "name" field. The option's name. For protobuf built-in options (options defined in descriptor.proto), this is the short name. For example, `"map_entry"`. For custom options, it should be the fully-qualified name. For example, `"google.api.http"`. Field number for the "value" field. The option's value packed in an Any message. If the value is a primitive, the corresponding wrapper type defined in google/protobuf/wrappers.proto should be used. If the value is an enum, it should be stored as an int32 value using the google.protobuf.Int32Value type. Holder for reflection information generated from google/protobuf/wrappers.proto File descriptor for google/protobuf/wrappers.proto Field number for the single "value" field in all wrapper types. Wrapper message for `double`. The JSON representation for `DoubleValue` is JSON number. Field number for the "value" field. The double value. Wrapper message for `float`. The JSON representation for `FloatValue` is JSON number. Field number for the "value" field. The float value. Wrapper message for `int64`. The JSON representation for `Int64Value` is JSON string. Field number for the "value" field. The int64 value. Wrapper message for `uint64`. The JSON representation for `UInt64Value` is JSON string. Field number for the "value" field. The uint64 value. Wrapper message for `int32`. The JSON representation for `Int32Value` is JSON number. Field number for the "value" field. The int32 value. Wrapper message for `uint32`. The JSON representation for `UInt32Value` is JSON number. Field number for the "value" field. The uint32 value. Wrapper message for `bool`. The JSON representation for `BoolValue` is JSON `true` and `false`. Field number for the "value" field. The bool value. Wrapper message for `string`. The JSON representation for `StringValue` is JSON string. Field number for the "value" field. The string value. Wrapper message for `bytes`. The JSON representation for `BytesValue` is JSON string. Field number for the "value" field. The bytes value. This class is used internally by the Protocol Buffer Library and generated message implementations. It is public only for the sake of those generated messages. Others should not use this class directly. This class contains constants and helper functions useful for dealing with the Protocol Buffer wire format. Wire types within protobuf encoding. Variable-length integer. A fixed-length 64-bit value. A length-delimited value, i.e. a length followed by that many bytes of data. A "start group" value An "end group" value A fixed-length 32-bit value. Given a tag value, determines the wire type (lower 3 bits). Given a tag value, determines the field number (the upper 29 bits). Makes a tag value given a field number and wire type. Abstraction for writing to a steam / IBufferWriter Initialize an instance with a coded output stream. This approach is faster than using a constructor because the instance to initialize is passed by reference and we can write directly into it without copying. Initialize an instance with a buffer writer. This approach is faster than using a constructor because the instance to initialize is passed by reference and we can write directly into it without copying. Initialize an instance with a buffer represented by a single span (i.e. buffer cannot be refreshed) This approach is faster than using a constructor because the instance to initialize is passed by reference and we can write directly into it without copying. Verifies that SpaceLeft returns zero. If writing to a flat array, returns the space left in the array. Otherwise, throws an InvalidOperationException. An opaque struct that represents the current serialization state and is passed along as the serialization proceeds. All the public methods are intended to be invoked only by the generated code, users should never invoke them directly. Creates a WriteContext instance from CodedOutputStream. WARNING: internally this copies the CodedOutputStream's state, so after done with the WriteContext, the CodedOutputStream's state needs to be updated. Writes a double field value, without a tag. The value to write Writes a float field value, without a tag. The value to write Writes a uint64 field value, without a tag. The value to write Writes an int64 field value, without a tag. The value to write Writes an int32 field value, without a tag. The value to write Writes a fixed64 field value, without a tag. The value to write Writes a fixed32 field value, without a tag. The value to write Writes a bool field value, without a tag. The value to write Writes a string field value, without a tag. The data is length-prefixed. The value to write Writes a message, without a tag. The data is length-prefixed. The value to write Writes a group, without a tag, to the stream. The value to write Write a byte string, without a tag, to the stream. The data is length-prefixed. The value to write Writes a uint32 value, without a tag. The value to write Writes an enum value, without a tag. The value to write Writes an sfixed32 value, without a tag. The value to write. Writes an sfixed64 value, without a tag. The value to write Writes an sint32 value, without a tag. The value to write Writes an sint64 value, without a tag. The value to write Writes a length (in bytes) for length-delimited data. This method simply writes a rawint, but exists for clarity in calling code. Length value, in bytes. Encodes and writes a tag. The number of the field to write the tag for The wire format type of the tag to write Writes an already-encoded tag. The encoded tag Writes the given single-byte tag. The encoded tag Writes the given two-byte tag. The first byte of the encoded tag The second byte of the encoded tag Writes the given three-byte tag. The first byte of the encoded tag The second byte of the encoded tag The third byte of the encoded tag Writes the given four-byte tag. The first byte of the encoded tag The second byte of the encoded tag The third byte of the encoded tag The fourth byte of the encoded tag Writes the given five-byte tag. The first byte of the encoded tag The second byte of the encoded tag The third byte of the encoded tag The fourth byte of the encoded tag The fifth byte of the encoded tag Primitives for encoding protobuf wire format. Writes a double field value, without a tag, to the stream. Writes a float field value, without a tag, to the stream. Writes a uint64 field value, without a tag, to the stream. Writes an int64 field value, without a tag, to the stream. Writes an int32 field value, without a tag, to the stream. Writes a fixed64 field value, without a tag, to the stream. Writes a fixed32 field value, without a tag, to the stream. Writes a bool field value, without a tag, to the stream. Writes a string field value, without a tag, to the stream. The data is length-prefixed. Given a QWORD which represents a buffer of 4 ASCII chars in machine-endian order, narrows each WORD to a BYTE, then writes the 4-byte result to the output buffer also in machine-endian order. Write a byte string, without a tag, to the stream. The data is length-prefixed. Writes a uint32 value, without a tag, to the stream. Writes an enum value, without a tag, to the stream. Writes an sfixed32 value, without a tag, to the stream. Writes an sfixed64 value, without a tag, to the stream. Writes an sint32 value, without a tag, to the stream. Writes an sint64 value, without a tag, to the stream. Writes a length (in bytes) for length-delimited data. This method simply writes a rawint, but exists for clarity in calling code. 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. Writes out an array of bytes. Writes out part of an array of bytes. Writes out part of an array of bytes. Encodes and writes a tag. Writes an already-encoded tag. Writes the given single-byte tag directly to the stream. Writes the given two-byte tag directly to the stream. Writes the given three-byte tag directly to the stream. Writes the given four-byte tag directly to the stream. Writes the given five-byte tag directly to the stream. Encode a 32-bit value with ZigZag encoding. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.) Encode a 64-bit value with ZigZag encoding. ZigZag encodes signed integers into values that can be efficiently encoded with varint. (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, thus always taking 10 bytes on the wire.) Writing messages / groups. Writes a message, without a tag. The data is length-prefixed. Writes a group, without a tag. Writes a message, without a tag. Message will be written without a length prefix. Indicates that certain members on a specified are accessed dynamically, for example through . This allows tools to understand which members are being accessed during the execution of a program. This attribute is valid on members whose type is or . When this attribute is applied to a location of type , the assumption is that the string represents a fully qualified type name. When this attribute is applied to a class, interface, or struct, the members specified can be accessed dynamically on instances returned from calling on instances of that class, interface, or struct. If the attribute is applied to a method it's treated as a special case and it implies the attribute should be applied to the "this" parameter of the method. As such the attribute should only be used on instance methods of types assignable to System.Type (or string, but no methods will use it there). Initializes a new instance of the class with the specified member types. The types of members dynamically accessed. Gets the which specifies the type of members dynamically accessed. Specifies the types of members that are dynamically accessed. This enumeration has a attribute that allows a bitwise combination of its member values. Specifies no members. Specifies the default, parameterless public constructor. Specifies all public constructors. Specifies all non-public constructors. Specifies all public methods. Specifies all non-public methods. Specifies all public fields. Specifies all non-public fields. Specifies all public nested types. Specifies all non-public nested types. Specifies all public properties. Specifies all non-public properties. Specifies all public events. Specifies all non-public events. Specifies all interfaces implemented by the type. Specifies all members. Indicates that the specified method requires dynamic access to code that is not referenced statically, for example through . This allows tools to understand which methods are unsafe to call when removing unreferenced code from an application. Initializes a new instance of the class with the specified message. A message that contains information about the usage of unreferenced code. Gets a message that contains information about the usage of unreferenced code. Gets or sets an optional URL that contains more information about the method, why it requires unreferenced code, and what options a consumer has to deal with it. Suppresses reporting of a specific rule violation, allowing multiple suppressions on a single code artifact. is different than in that it doesn't have a . So it is always preserved in the compiled assembly. Initializes a new instance of the class, specifying the category of the tool and the identifier for an analysis rule. The category for the attribute. The identifier of the analysis rule the attribute applies to. Gets the category identifying the classification of the attribute. The property describes the tool or tool analysis category for which a message suppression attribute applies. Gets the identifier of the analysis tool rule to be suppressed. Concatenated together, the and properties form a unique check identifier. Gets or sets the scope of the code that is relevant for the attribute. The Scope property is an optional argument that specifies the metadata scope for which the attribute is relevant. Gets or sets a fully qualified path that represents the target of the attribute. The property is an optional argument identifying the analysis target of the attribute. An example value is "System.IO.Stream.ctor():System.Void". Because it is fully qualified, it can be long, particularly for targets such as parameters. The analysis tool user interface should be capable of automatically formatting the parameter. Gets or sets an optional argument expanding on exclusion criteria. The property is an optional argument that specifies additional exclusion where the literal metadata target is not sufficiently precise. For example, the cannot be applied within a method, and it may be desirable to suppress a violation against a statement in the method that will give a rule violation, but not against all statements in the method. Gets or sets the justification for suppressing the code analysis message.