Space Engineers
Public Member Functions | Static Public Member Functions | Properties | List of all members
ProtoBuf.ProtoWriter Class Reference

Represents an output stream for writing protobuf data. More...

Inheritance diagram for ProtoBuf.ProtoWriter:

Public Member Functions

 ProtoWriter (Stream dest, TypeModel model, SerializationContext context)
 Creates a new writer against a stream More...
 
void Close ()
 Flushes data to the underlying stream, and releases any resources. The underlying stream is not disposed by this operation. More...
 
void SetRootObject (object value)
 Specifies a known root object to use during reference-tracked serialization More...
 

Static Public Member Functions

static void WriteObject (object value, int key, ProtoWriter writer)
 Write an encapsulated sub-object, using the supplied unique key (reprasenting a type). More...
 
static void WriteRecursionSafeObject (object value, int key, ProtoWriter writer)
 Write an encapsulated sub-object, using the supplied unique key (reprasenting a type) - but the caller is asserting that this relationship is non-recursive; no recursion check will be performed. More...
 
static void WriteFieldHeader (int fieldNumber, WireType wireType, ProtoWriter writer)
 Writes a field-header, indicating the format of the next data we plan to write. More...
 
static void WriteBytes (byte[] data, ProtoWriter writer)
 Writes a byte-array to the stream; supported wire-types: String More...
 
static void WriteBytes (byte[] data, int offset, int length, ProtoWriter writer)
 Writes a byte-array to the stream; supported wire-types: String More...
 
static SubItemToken StartSubItem (object instance, ProtoWriter writer)
 Indicates the start of a nested record. More...
 
static void EndSubItem (SubItemToken token, ProtoWriter writer)
 Indicates the end of a nested record. More...
 
static void WriteString (string value, ProtoWriter writer)
 Writes a string to the stream; supported wire-types: String More...
 
static void WriteUInt64 (ulong value, ProtoWriter writer)
 Writes an unsigned 64-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64 More...
 
static void WriteInt64 (long value, ProtoWriter writer)
 Writes a signed 64-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant More...
 
static void WriteUInt32 (uint value, ProtoWriter writer)
 Writes an unsigned 16-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64 More...
 
static void WriteInt16 (short value, ProtoWriter writer)
 Writes a signed 16-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant More...
 
static void WriteUInt16 (ushort value, ProtoWriter writer)
 Writes an unsigned 16-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64 More...
 
static void WriteByte (byte value, ProtoWriter writer)
 Writes an unsigned 8-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64 More...
 
static void WriteSByte (sbyte value, ProtoWriter writer)
 Writes a signed 8-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant More...
 
static void WriteInt32 (int value, ProtoWriter writer)
 Writes a signed 32-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant More...
 
static unsafe void WriteDouble (double value, ProtoWriter writer)
 Writes a double-precision number to the stream; supported wire-types: Fixed32, Fixed64 More...
 
static unsafe void WriteSingle (float value, ProtoWriter writer)
 Writes a single-precision number to the stream; supported wire-types: Fixed32, Fixed64 More...
 
static void ThrowEnumException (ProtoWriter writer, object enumValue)
 Throws an exception indicating that the given enum cannot be mapped to a serialized value. More...
 
static void WriteBoolean (bool value, ProtoWriter writer)
 Writes a boolean to the stream; supported wire-types: Variant, Fixed32, Fixed64 More...
 
static void AppendExtensionData (IExtensible instance, ProtoWriter writer)
 Copies any extension data stored for the instance to the underlying stream More...
 
static void SetPackedField (int fieldNumber, ProtoWriter writer)
 Used for packed encoding; indicates that the next field should be skipped rather than a field header written. Note that the field number must match, else an exception is thrown when the attempt is made to write the (incorrect) field. The wire-type is taken from the subsequent call to WriteFieldHeader. Only primitive types can be packed. More...
 
static void WriteType (System.Type value, ProtoWriter writer)
 Writes a Type to the stream, using the model's DynamicTypeFormatting if appropriate; supported wire-types: String More...
 

Properties

SerializationContext Context [get]
 Addition information about this serialization operation. More...
 
TypeModel Model [get]
 Get the TypeModel associated with this writer More...
 

Detailed Description

Represents an output stream for writing protobuf data.

Why is the API backwards (static methods with writer arguments)? See: http://marcgravell.blogspot.com/2010/03/last-will-be-first-and-first-will-be.html

Definition at line 23 of file ProtoWriter.cs.

Constructor & Destructor Documentation

ProtoBuf.ProtoWriter.ProtoWriter ( Stream  dest,
TypeModel  model,
SerializationContext  context 
)
inline

Creates a new writer against a stream

Parameters
destThe destination stream
modelThe model to use for serialization; this can be null, but this will impair the ability to serialize sub-objects
contextAdditional context about this serialization operation

Definition at line 445 of file ProtoWriter.cs.

Member Function Documentation

static void ProtoBuf.ProtoWriter.AppendExtensionData ( IExtensible  instance,
ProtoWriter  writer 
)
inlinestatic

Copies any extension data stored for the instance to the underlying stream

Definition at line 878 of file ProtoWriter.cs.

void ProtoBuf.ProtoWriter.Close ( )
inline

Flushes data to the underlying stream, and releases any resources. The underlying stream is not disposed by this operation.

Definition at line 502 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.EndSubItem ( SubItemToken  token,
ProtoWriter  writer 
)
inlinestatic

Indicates the end of a nested record.

Parameters
tokenThe token obtained from StartubItem.
writerThe destination.

Definition at line 359 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.SetPackedField ( int  fieldNumber,
ProtoWriter  writer 
)
inlinestatic

Used for packed encoding; indicates that the next field should be skipped rather than a field header written. Note that the field number must match, else an exception is thrown when the attempt is made to write the (incorrect) field. The wire-type is taken from the subsequent call to WriteFieldHeader. Only primitive types can be packed.

Definition at line 907 of file ProtoWriter.cs.

void ProtoBuf.ProtoWriter.SetRootObject ( object  value)
inline

Specifies a known root object to use during reference-tracked serialization

Definition at line 920 of file ProtoWriter.cs.

static SubItemToken ProtoBuf.ProtoWriter.StartSubItem ( object  instance,
ProtoWriter  writer 
)
inlinestatic

Indicates the start of a nested record.

Parameters
instanceThe instance to write.
writerThe destination.
Returns
A token representing the state of the stream; this token is given to EndSubItem.

Definition at line 290 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.ThrowEnumException ( ProtoWriter  writer,
object  enumValue 
)
inlinestatic

Throws an exception indicating that the given enum cannot be mapped to a serialized value.

Definition at line 856 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteBoolean ( bool  value,
ProtoWriter  writer 
)
inlinestatic

Writes a boolean to the stream; supported wire-types: Variant, Fixed32, Fixed64

Definition at line 870 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteByte ( byte  value,
ProtoWriter  writer 
)
inlinestatic

Writes an unsigned 8-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64

Definition at line 720 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteBytes ( byte[]  data,
ProtoWriter  writer 
)
inlinestatic

Writes a byte-array to the stream; supported wire-types: String

Definition at line 191 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteBytes ( byte[]  data,
int  offset,
int  length,
ProtoWriter  writer 
)
inlinestatic

Writes a byte-array to the stream; supported wire-types: String

Definition at line 198 of file ProtoWriter.cs.

static unsafe void ProtoBuf.ProtoWriter.WriteDouble ( double  value,
ProtoWriter  writer 
)
inlinestatic

Writes a double-precision number to the stream; supported wire-types: Fixed32, Fixed64

Definition at line 804 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteFieldHeader ( int  fieldNumber,
WireType  wireType,
ProtoWriter  writer 
)
inlinestatic

Writes a field-header, indicating the format of the next data we plan to write.

Definition at line 136 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteInt16 ( short  value,
ProtoWriter  writer 
)
inlinestatic

Writes a signed 16-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant

Definition at line 706 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteInt32 ( int  value,
ProtoWriter  writer 
)
inlinestatic

Writes a signed 32-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant

Definition at line 742 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteInt64 ( long  value,
ProtoWriter  writer 
)
inlinestatic

Writes a signed 64-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant

Definition at line 624 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteObject ( object  value,
int  key,
ProtoWriter  writer 
)
inlinestatic

Write an encapsulated sub-object, using the supplied unique key (reprasenting a type).

Parameters
valueThe object to write.
keyThe key that uniquely identifies the type within the model.
writerThe destination.

Definition at line 33 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteRecursionSafeObject ( object  value,
int  key,
ProtoWriter  writer 
)
inlinestatic

Write an encapsulated sub-object, using the supplied unique key (reprasenting a type) - but the caller is asserting that this relationship is non-recursive; no recursion check will be performed.

Parameters
valueThe object to write.
keyThe key that uniquely identifies the type within the model.
writerThe destination.

Definition at line 67 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteSByte ( sbyte  value,
ProtoWriter  writer 
)
inlinestatic

Writes a signed 8-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64, SignedVariant

Definition at line 727 of file ProtoWriter.cs.

static unsafe void ProtoBuf.ProtoWriter.WriteSingle ( float  value,
ProtoWriter  writer 
)
inlinestatic

Writes a single-precision number to the stream; supported wire-types: Fixed32, Fixed64

Definition at line 835 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteString ( string  value,
ProtoWriter  writer 
)
inlinestatic

Writes a string to the stream; supported wire-types: String

Definition at line 573 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteType ( System.Type  value,
ProtoWriter  writer 
)
inlinestatic

Writes a Type to the stream, using the model's DynamicTypeFormatting if appropriate; supported wire-types: String

Definition at line 928 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteUInt16 ( ushort  value,
ProtoWriter  writer 
)
inlinestatic

Writes an unsigned 16-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64

Definition at line 713 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteUInt32 ( uint  value,
ProtoWriter  writer 
)
inlinestatic

Writes an unsigned 16-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64

Definition at line 683 of file ProtoWriter.cs.

static void ProtoBuf.ProtoWriter.WriteUInt64 ( ulong  value,
ProtoWriter  writer 
)
inlinestatic

Writes an unsigned 64-bit integer to the stream; supported wire-types: Variant, Fixed32, Fixed64

Definition at line 602 of file ProtoWriter.cs.

Property Documentation

SerializationContext ProtoBuf.ProtoWriter.Context
get

Addition information about this serialization operation.

Definition at line 464 of file ProtoWriter.cs.

TypeModel ProtoBuf.ProtoWriter.Model
get

Get the TypeModel associated with this writer

Definition at line 516 of file ProtoWriter.cs.


The documentation for this class was generated from the following file: