Avro C#
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Avro.IO.ParsingEncoder Class Referenceabstract

Base class for a Parsing.Parser-based Encoders. More...

Inheritance diagram for Avro.IO.ParsingEncoder:
Avro.IO.Encoder Avro.IO.JsonEncoder

Public Member Functions

abstract void WriteNull ()
 Writes a null value.
 
abstract void WriteBoolean (bool value)
 Writes a boolean value.
 
abstract void WriteInt (int value)
 Writes an int value.
 
abstract void WriteLong (long value)
 Writes a long value.
 
abstract void WriteFloat (float value)
 Writes a float value.
 
abstract void WriteDouble (double value)
 Writes a double value.
 
abstract void WriteBytes (byte[] value)
 Writes a byte string.
 
abstract void WriteBytes (byte[] value, int offset, int length)
 Writes a byte string.
 
abstract void WriteString (string value)
 Writes an Unicode string.
 
abstract void WriteEnum (int value)
 Writes an enumeration.
 
abstract void WriteArrayStart ()
 Call this method to start writing an array. When starting to serialize an array, call WriteArrayStart. Then, before writing any data for any item call SetItemCount(long) followed by a sequence of StartItem and the item itself. The number of StartItem should match the number specified in SetItemCount(long). When actually writing the data of the item, you can call any Encoder method (e.g., WriteLong(long)). When all items of the array have been written, call WriteArrayEnd. As an example, let's say you want to write an array of records, the record consisting of an Long field and a Boolean field. Your code would look something like this:
out.WriteArrayStart();
out.SetItemCount(list.Count);
foreach (var r in list)
{
out.StartItem();
out.WriteLong(r.LongField);
out.WriteBoolean(r.BoolField);
}
out.WriteArrayEnd();

 
abstract void WriteArrayEnd ()
 Call this method to finish writing an array. See WriteArrayStart for usage information.
 
abstract void WriteMapStart ()
 Call this to start a new map. See WriteArrayStart for details on usage. As an example of usage, let's say you want to write a map of records, the record consisting of an Long field and a Boolean field. Your code would look something like this:
out.WriteMapStart();
out.SetItemCount(dictionary.Count);
foreach (var entry in dictionary)
{
out.StartItem();
out.WriteString(entry.Key);
out.writeLong(entry.Value.LongField);
out.writeBoolean(entry.Value.BoolField);
}
out.WriteMapEnd();

 
abstract void WriteMapEnd ()
 Call this method to terminate the inner-most, currently-opened map. See WriteArrayStart for more details.
 
abstract void WriteUnionIndex (int value)
 Call this method to write the tag of a union. As an example of usage, let's say you want to write a union, whose second branch is a record consisting of an Long field and a Boolean field. Your code would look something like this:
out.WriteIndex(1);
out.WriteLong(record.LongField);
out.WriteBoolean(record.BoolField);

 
abstract void WriteFixed (byte[] data)
 Writes a fixed value.
 
abstract void WriteFixed (byte[] data, int start, int len)
 Writes a fixed value.
 
abstract void Flush ()
 Flushes the encoder.
 
virtual void SetItemCount (long value)
 Call this method before writing a batch of items in an array or a map.
 
virtual void StartItem ()
 Start a new item of an array or map. See WriteArrayStart for usage information.
 

Protected Member Functions

void Push ()
 Push a new collection on to the stack. More...
 
void Pop ()
 Pop a new collection on to the stack. More...
 
int Depth ()
 Returns the position into the stack. More...
 

Protected Attributes

int Pos = -1
 Position into the counts stack. More...
 

Detailed Description

Base class for a Parsing.Parser-based Encoders.

Member Function Documentation

◆ Depth()

int Avro.IO.ParsingEncoder.Depth ( )
inlineprotected

Returns the position into the stack.

◆ Pop()

void Avro.IO.ParsingEncoder.Pop ( )
inlineprotected

Pop a new collection on to the stack.

◆ Push()

void Avro.IO.ParsingEncoder.Push ( )
inlineprotected

Push a new collection on to the stack.

Member Data Documentation

◆ Pos

int Avro.IO.ParsingEncoder.Pos = -1
protected

Position into the counts stack.


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