Avro C#

Public Member Functions | Properties | List of all members
Avro.Generic.GenericReader< T > Class Template Reference

A general purpose reader of data from avro streams. This can optionally resolve if the reader's and writer's schemas are different. This class is a wrapper around DefaultReader and offers a little more type safety. The default reader has the flexibility to return any type of object for each read call because the Read() method is generic. This class on the other hand can only return a single type because the type is a parameter to the class. Any user defined extension should, however, be done to DefaultReader. This class is sealed. More...

Inheritance diagram for Avro.Generic.GenericReader< T >:

## Public Member Functions
| GenericReader (Schema writerSchema, Schema readerSchema)
| Constructs a generic reader for the given schemas using the DefaultReader. If the reader's and writer's schemas are different this class performs the resolution. More...
| GenericReader (DefaultReader reader)
| Constructs a generic reader by directly using the given DefaultReader More...
T | Read (T reuse, Decoder d)
| Reads an object off the stream. More...

## Properties
Schema | WriterSchema`[get]`
| Schema used to write the data. More...
Schema | ReaderSchema`[get]`
| Schema used to read the data. More...
Properties inherited from Avro.Generic.DatumReader< T >
Schema | ReaderSchema`[get]`
| Schema used to read the data. More...
Schema | WriterSchema`[get]`
| Schema that was used to write the data. More...

## Detailed Description

A general purpose reader of data from avro streams. This can optionally resolve if the reader's and writer's schemas are different. This class is a wrapper around DefaultReader and offers a little more type safety. The default reader has the flexibility to return any type of object for each read call because the Read() method is generic. This class on the other hand can only return a single type because the type is a parameter to the class. Any user defined extension should, however, be done to DefaultReader. This class is sealed.

Template Parameters

  T |

## Constructor & Destructor Documentation

## ◆ GenericReader() [1/2]

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

Constructs a generic reader for the given schemas using the DefaultReader. If the reader's and writer's schemas are different this class performs the resolution.

Parameters

  writerSchema | The schema used while generating the data
  readerSchema | The schema desired by the reader

## ◆ GenericReader() [2/2]

Avro.Generic.GenericReader< T >.GenericReader | ( | DefaultReader | reader | ) |
| inline

Constructs a generic reader by directly using the given DefaultReader

Parameters

  reader | The actual reader to use

## Member Function Documentation

## ◆ Read()

T Avro.Generic.GenericReader< T >.Read | ( | T | reuse,
|  | Decoder | d
| ) |  |
| inline

Reads an object off the stream.

Parameters

  reuse | If not null, the implementation will try to use to return the object
  d | Decoder to read from.

Returns
  Object we read from the decoder.

Implements Avro.Generic.DatumReader< T >.

## Property Documentation

## ◆ ReaderSchema

Schema Avro.Generic.GenericReader< T >.ReaderSchema
| get

Schema used to read the data.

## ◆ WriterSchema

Schema Avro.Generic.GenericReader< T >.WriterSchema
| get

Schema used to write the data.

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

- src/apache/main/Generic/GenericReader.cs