Enhanced C#
Loyc library documentation
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Nested classes | Properties | List of all members
SyncProtobuf.Options Class Reference

Options that control the behavior of SyncProtobuf.Reader and SyncProtobuf.Writer. More...


Source file:
Inheritance diagram for SyncProtobuf.Options:

Remarks

Options that control the behavior of SyncProtobuf.Reader and SyncProtobuf.Writer.

Reader and Writer do not copy this object, so changing its properties affects any reader/writer that was constructed with it.

Note: reader behaviors that are options in other formats are fixed here by Protobuf semantics: an absent field read as a non-nullable primitive returns the type's default value, integers too large for the requested type are truncated to its low bits (as Protobuf parsers do), and the root message always occupies the entire input.

Nested classes

class  ForWriter
 

Properties

int MaxPayloadSize [get, set]
 Maximum size, in bytes, of a length-delimited payload (string, byte array, sub-message, list, etc.) that the reader will accept. This guards against corrupt or malicious inputs that claim an enormous length. The default is 64 MB. More...
 
ObjectMode RootMode = 64 * 1024 * 1024 [get, set]
 The ObjectMode used to read/write the root object. This option has no effect if you use NewWriter or NewReader(ReadOnlyMemory{byte}, Options?) directly. More...
 
ForWriter Write = ObjectMode.Normal [get, set]
 

Property Documentation

int SyncProtobuf.Options.MaxPayloadSize
getset

Maximum size, in bytes, of a length-delimited payload (string, byte array, sub-message, list, etc.) that the reader will accept. This guards against corrupt or malicious inputs that claim an enormous length. The default is 64 MB.

ObjectMode SyncProtobuf.Options.RootMode = 64 * 1024 * 1024
getset

The ObjectMode used to read/write the root object. This option has no effect if you use NewWriter or NewReader(ReadOnlyMemory{byte}, Options?) directly.

The same mode must be used when writing and when reading; in particular, toggling ObjectMode.Deduplicate changes the wire format of the root object (see SyncProtobuf).