Avro C#
Loading...
Searching...
No Matches
Avro.Generic.GenericDatumReader< T > Class Template Reference

PreresolvingDatumReader<T> for reading data to GenericRecord classes or primitives. For more information about performance considerations for choosing this implementation. More...

Inheritance diagram for Avro.Generic.GenericDatumReader< T >:
Avro.Generic.PreresolvingDatumReader< T > Avro.Generic.DatumReader< T >

Classes

class  GenericRecordAccess

Public Member Functions

 GenericDatumReader (Schema writerSchema, Schema readerSchema)
 Initializes a new instance of the GenericDatumReader<T> class.
 GenericEnumAccess (EnumSchema schema)
object CreateEnum (object reuse, int ordinal)
 GenericRecordAccess (RecordSchema schema)
object CreateRecord (object reuse)
object GetField (object record, string fieldName, int fieldPos)
void AddField (object record, string fieldName, int fieldPos, object fieldValue)
 GenericFixedAccess (FixedSchema schema)
object CreateFixed (object reuse)
byte[] GetFixedBuffer (object f)
object Create (object reuse)
void EnsureSize (ref object array, int targetSize)
void Resize (ref object array, int targetSize)
void AddElements (object arrayObj, int elements, int index, ReadItem itemReader, Decoder decoder, bool reuse)
object Create (object reuse)
void AddElements (object mapObj, int elements, ReadItem itemReader, Decoder decoder, bool reuse)
Public Member Functions inherited from Avro.Generic.PreresolvingDatumReader< T >
T Read (T reuse, Decoder decoder)
 Read a datum. Traverse the schema, depth-first, reading all leaf values in the schema into a datum that is returned. If the provided datum is non-null it may be reused and returned.
Parameters
reuseOptional object to deserialize the datum into. May be null.
decoderDecoder to read data from.
Returns
Deserialized datum.

object CreateRecord (object reuse)
 Creates a new record object. Derived classes can override this to return an object of their choice.
object GetField (object record, string fieldName, int fieldPos)
 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.
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.
object CreateEnum (object reuse, int ordinal)
 Creates an enum value.
object CreateFixed (object reuse)
 Returns a fixed object.
byte[] GetFixedBuffer (object f)
 Returns a buffer of appropriate size to read data into.
object Create (object reuse)
 Creates a new array object. The initial size of the object could be anything.
void EnsureSize (ref object array, int targetSize)
 Hint that the array should be able to handle at least targetSize elements. The array is not required to be resized.
void Resize (ref object array, int targetSize)
 Resizes the array to the new value.
void AddElements (object array, int elements, int index, ReadItem itemReader, Decoder decoder, bool reuse)
 Adds elements to the given array by reading values from the decoder.
object Create (object reuse)
 Creates a new map object.
void AddElements (object map, int elements, ReadItem itemReader, Decoder decoder, bool reuse)
 Adds elements to the given map by reading values from the decoder.
 SchemaPair (Schema writerSchema, Schema readerSchema)
override bool Equals (object obj)
override int GetHashCode ()

Protected Member Functions

override bool IsReusable (Schema.Type tag)
 Indicates if it's possible to reuse an object of the specified type. Generally false for immutable objects like int, long, string, etc but may differ between the Specific and Generic implementations. Used to avoid retrieving the existing value if it's not reusable.
Parameters
tagSchema type to test for reusability.

override ArrayAccess GetArrayAccess (ArraySchema readerSchema)
override EnumAccess GetEnumAccess (EnumSchema readerSchema)
override MapAccess GetMapAccess (MapSchema readerSchema)
override RecordAccess GetRecordAccess (RecordSchema readerSchema)
override FixedAccess GetFixedAccess (FixedSchema readerSchema)
Protected Member Functions inherited from Avro.Generic.PreresolvingDatumReader< T >
delegate object ReadItem (object reuse, Decoder dec)
 Defines the signature for a function that reads an item from a decoder.
 PreresolvingDatumReader (Schema writerSchema, Schema readerSchema)
 Initializes a new instance of the PreresolvingDatumReader<T> class.
ArrayAccess GetArrayAccess (ArraySchema readerSchema)
 Returns an ArrayAccess implementation for the given schema.
EnumAccess GetEnumAccess (EnumSchema readerSchema)
 Returns an EnumAccess implementation for the given schema.
MapAccess GetMapAccess (MapSchema readerSchema)
 Returns a MapAccess implementation for the given schema.
RecordAccess GetRecordAccess (RecordSchema readerSchema)
 Returns a RecordAccess implementation for the given schema.
FixedAccess GetFixedAccess (FixedSchema readerSchema)
 Returns a FixedAccess implementation for the given schema.
bool Equals (SchemaPair other)

Additional Inherited Members

Static Protected Member Functions inherited from Avro.Generic.PreresolvingDatumReader< T >
static Schema FindBranch (UnionSchema us, Schema s)
 Finds the branch of the union schema associated with the given schema.
Properties inherited from Avro.Generic.PreresolvingDatumReader< T >
Schema ReaderSchema [get]
 Schema used to read the data.
Schema WriterSchema [get]
 Schema that was used to write the data.

Detailed Description

PreresolvingDatumReader<T> for reading data to GenericRecord classes or primitives. For more information about performance considerations for choosing this implementation.

Template Parameters
TType to deserialize data into.

Member Function Documentation

◆ GenericDatumReader()

Avro.Generic.GenericDatumReader< T >.GenericDatumReader ( Schema writerSchema,
Schema readerSchema )
inline

Initializes a new instance of the GenericDatumReader<T> class.

Parameters
writerSchemaSchema that was used to write the data.
readerSchemaSchema to use to read the data.

◆ IsReusable()

override bool Avro.Generic.GenericDatumReader< T >.IsReusable ( Schema.Type tag)
inlineprotectedvirtual

Indicates if it's possible to reuse an object of the specified type. Generally false for immutable objects like int, long, string, etc but may differ between the Specific and Generic implementations. Used to avoid retrieving the existing value if it's not reusable.

Parameters
tagSchema type to test for reusability.

Reimplemented from Avro.Generic.PreresolvingDatumReader< T >.


The documentation for this class was generated from the following file:
  • src/apache/main/Generic/GenericDatumReader.cs