Avro C#
Public Member Functions | Protected Member Functions | List of all members
Avro.Specific.SpecificDefaultReader Class Reference

Reader class for reading data and storing into specific classes More...

Inheritance diagram for Avro.Specific.SpecificDefaultReader:
Avro.Generic.DefaultReader Avro.Reflect.ReflectDefaultReader

Public Member Functions

 SpecificDefaultReader (Schema writerSchema, Schema readerSchema)
 Constructor More...
 
- Public Member Functions inherited from Avro.Generic.DefaultReader
 DefaultReader (Schema writerSchema, Schema readerSchema)
 Constructs the default reader for the given schemas using the DefaultReader. If the reader's and writer's schemas are different this class performs the resolution. This default implementation maps Avro types to .NET types as follows: More...
 
Read< T > (T reuse, Decoder decoder)
 Reads an object off the stream. More...
 
object Read (object reuse, Schema writerSchema, Schema readerSchema, Decoder d)
 Reads an object off the stream. More...
 

Protected Member Functions

override object ReadRecord (object reuse, RecordSchema writerSchema, Schema readerSchema, Decoder dec)
 Deserializes a record from the stream. More...
 
override object ReadFixed (object reuse, FixedSchema writerSchema, Schema readerSchema, Decoder d)
 Deserializes a fixed object and returns the object. The default implementation uses CreateFixed() and GetFixedBuffer() and returns what CreateFixed() returned. More...
 
override object ReadEnum (object reuse, EnumSchema writerSchema, Schema readerSchema, Decoder dec)
 Reads an enum from the given decoder More...
 
override object ReadArray (object reuse, ArraySchema writerSchema, Schema readerSchema, Decoder dec)
 Reads an array from the given decoder More...
 
override object ReadMap (object reuse, MapSchema writerSchema, Schema readerSchema, Decoder d)
 Deserialized an avro map. The default implementation creates a new map using CreateMap() and then adds elements to the map using AddMapEntry(). More...
 
virtual string getTargetType (Schema schema)
 Gets the target type name in the given schema More...
 
- Protected Member Functions inherited from Avro.Generic.DefaultReader
virtual object ReadNull (Schema readerSchema, Decoder d)
 Deserializes a null from the stream. More...
 
Read< T > (Schema.Type tag, Schema readerSchema, Reader< T > reader)
 A generic function to read primitive types More...
 
virtual object CreateRecord (object reuse, RecordSchema readerSchema)
 Creates a new record object. Derived classes can override this to return an object of their choice. More...
 
virtual bool TryGetField (object record, string fieldName, int fieldPos, out object value)
 Used by the default implementation of ReadRecord() to get the existing field of a record object. The derived classes can override this to make their own interpretation of the record object. More...
 
virtual void AddField (object record, string fieldName, int fieldPos, object fieldValue)
 Used by the default implementation of ReadRecord() to add a field to a record object. The derived classes can override this to suit their own implementation of the record object. More...
 
virtual object CreateEnum (object reuse, EnumSchema es, string symbol)
 Used by the default implementation of ReadEnum to construct a new enum object. More...
 
virtual object CreateArray (object reuse, ArraySchema rs)
 Creates a new array object. The initial size of the object could be anything. The users should use GetArraySize() to determine the size. The default implementation creates an object[]. More...
 
virtual int GetArraySize (object array)
 Returns the size of the given array object. More...
 
virtual void ResizeArray (ref object array, int n)
 Resizes the array to the new value. More...
 
virtual void SetArrayElement (object array, int index, object value)
 Assigns a new value to the object at the given index More...
 
virtual object GetArrayElement (object array, int index)
 Returns the element at the given index. More...
 
virtual object CreateMap (object reuse, MapSchema ms)
 Used by the default implementation of ReadMap() to create a fresh map object. The default implementation of this method returns a IDictionary<string, map>. More...
 
virtual void AddMapEntry (object map, string key, object value)
 Adds an entry to the map. More...
 
virtual object ReadUnion (object reuse, UnionSchema writerSchema, Schema readerSchema, Decoder d)
 Deserialized an object based on the writer's union schema. More...
 
virtual object ReadLogical (object reuse, LogicalSchema writerSchema, Schema readerSchema, Decoder d)
 Deserializes an object based on the writer's logical schema. Uses the underlying logical type to convert the value to the logical type. More...
 
virtual object CreateFixed (object reuse, FixedSchema rs)
 Returns a fixed object. More...
 
virtual byte[] GetFixedBuffer (object f)
 Returns a buffer of appropriate size to read data into. More...
 
virtual void Skip (Schema writerSchema, Decoder d)
 Skip an instance of a schema. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from Avro.Generic.DefaultReader
static Schema findBranch (UnionSchema us, Schema s)
 Finds the branch of the union schema associated with the given schema. More...
 
- Properties inherited from Avro.Generic.DefaultReader
Schema ReaderSchema [get]
 Schema to use when reading data with this reader. More...
 
Schema WriterSchema [get]
 Schema used to write data that we are reading with this reader. More...
 

Detailed Description

Reader class for reading data and storing into specific classes

Constructor & Destructor Documentation

◆ SpecificDefaultReader()

Avro.Specific.SpecificDefaultReader.SpecificDefaultReader ( Schema  writerSchema,
Schema  readerSchema 
)
inline

Constructor

Parameters
writerSchemaschema of the object that wrote the data
readerSchemaschema of the object that will store the data

Member Function Documentation

◆ getTargetType()

virtual string Avro.Specific.SpecificDefaultReader.getTargetType ( Schema  schema)
inlineprotectedvirtual

Gets the target type name in the given schema

Parameters
schemaschema containing the type to be determined
Returns
Name of the type

◆ ReadArray()

override object Avro.Specific.SpecificDefaultReader.ReadArray ( object  reuse,
ArraySchema  writerSchema,
Schema  readerSchema,
Decoder  dec 
)
inlineprotectedvirtual

Reads an array from the given decoder

Parameters
reuseobject to store data read
writerSchemaschema of the object that wrote the data
readerSchemaschema of the object that will store the data
decdecoder object that contains the data to be read
Returns
array

Reimplemented from Avro.Generic.DefaultReader.

◆ ReadEnum()

override object Avro.Specific.SpecificDefaultReader.ReadEnum ( object  reuse,
EnumSchema  writerSchema,
Schema  readerSchema,
Decoder  dec 
)
inlineprotectedvirtual

Reads an enum from the given decoder

Parameters
reuseobject to store data read
writerSchemaschema of the object that wrote the data
readerSchemaschema of the object that will store the data
decdecoder object that contains the data to be read
Returns
enum value

Reimplemented from Avro.Generic.DefaultReader.

◆ ReadFixed()

override object Avro.Specific.SpecificDefaultReader.ReadFixed ( object  reuse,
FixedSchema  writerSchema,
Schema  readerSchema,
Decoder  d 
)
inlineprotectedvirtual

Deserializes a fixed object and returns the object. The default implementation uses CreateFixed() and GetFixedBuffer() and returns what CreateFixed() returned.

Parameters
reuseIf appropriate, uses this object instead of creating a new one.
writerSchemaThe FixedSchema the writer used during serialization.
readerSchemaThe schema that the reader uses. Must be a FixedSchema with the same size as the writerSchema.
dThe decoder for deserialization.
Returns
The deserialized object.

Reimplemented from Avro.Generic.DefaultReader.

◆ ReadMap()

override object Avro.Specific.SpecificDefaultReader.ReadMap ( object  reuse,
MapSchema  writerSchema,
Schema  readerSchema,
Decoder  d 
)
inlineprotectedvirtual

Deserialized an avro map. The default implementation creates a new map using CreateMap() and then adds elements to the map using AddMapEntry().

Parameters
reuseIf appropriate, use this instead of creating a new map object.
writerSchemaThe schema the writer used to write the map.
readerSchemaThe schema the reader is using.
dThe decoder for serialization.
Returns
The deserialized map object.

Reimplemented from Avro.Generic.DefaultReader.

◆ ReadRecord()

override object Avro.Specific.SpecificDefaultReader.ReadRecord ( object  reuse,
RecordSchema  writerSchema,
Schema  readerSchema,
Decoder  dec 
)
inlineprotectedvirtual

Deserializes a record from the stream.

Parameters
reuseIf not null, a record object that could be reused for returning the result
writerSchemaThe writer's RecordSchema
readerSchemaThe reader's schema, must be RecordSchema too.
decThe decoder for deserialization
Returns
The record object just read

Reimplemented from Avro.Generic.DefaultReader.


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