A general purpose writer of data from avro streams. This writer analyzes the writer schema when constructed so that writes can be more efficient. Once constructed, a writer can be reused or shared among threads to avoid incurring more resolution costs. More...
Classes | |
interface | ArrayAccess |
class | DictionaryMapAccess |
interface | EnumAccess |
interface | MapAccess |
class | RecordFieldWriter |
Public Member Functions | |
void | Write (T datum, Encoder encoder) |
Protected Member Functions | |
delegate void | WriteItem (Object value, Encoder encoder) |
PreresolvingDatumWriter (Schema schema, ArrayAccess arrayAccess, MapAccess mapAccess) | |
void | WriteNull (object value, Encoder encoder) |
Serializes a "null". | |
void | Write< S > (object value, Schema.Type tag, Writer< S > writer) |
A generic method to serialize primitive Avro types. | |
abstract void | WriteRecordFields (object record, RecordFieldWriter[] writers, Encoder encoder) |
abstract void | EnsureRecordObject (RecordSchema recordSchema, object value) |
abstract void | WriteField (object record, string fieldName, int fieldPos, WriteItem writer, Encoder encoder) |
Extracts the field value from the given object. | |
abstract WriteItem | ResolveEnum (EnumSchema es) |
Serializes an enumeration. | |
WriteItem | ResolveArray (ArraySchema schema) |
Serialized an array. The default implementation calls EnsureArrayObject() to ascertain that the given value is an array. It then calls GetArrayLength() and GetArrayElement() to access the members of the array and then serialize them. | |
void | WriteMap (WriteItem itemWriter, object value, Encoder encoder) |
Serialized a map. The default implementation first ensure that the value is indeed a map and then uses GetMapSize() and GetMapElements() to access the contents of the map. | |
int | ResolveUnion (UnionSchema us, Schema[] branchSchemas, object obj) |
Finds the branch within the given UnionSchema that matches the given object. The default implementation calls Matches() method in the order of branches within the UnionSchema. If nothing matches, throws an exception. | |
abstract void | WriteFixed (FixedSchema es, object value, Encoder encoder) |
Serialized a fixed object. The default implementation requires that the value is a GenericFixed object with an identical schema as es. | |
abstract bool | UnionBranchMatches (Schema sc, object obj) |
Static Protected Member Functions | |
static AvroException | TypeMismatch (object obj, string schemaType, string type) |
Properties | |
Schema | Schema [get, set] |
A general purpose writer of data from avro streams. This writer analyzes the writer schema when constructed so that writes can be more efficient. Once constructed, a writer can be reused or shared among threads to avoid incurring more resolution costs.
WriteItem Avro.Generic.PreresolvingDatumWriter< T >.ResolveArray | ( | ArraySchema | schema | ) | [inline, protected] |
Serialized an array. The default implementation calls EnsureArrayObject() to ascertain that the given value is an array. It then calls GetArrayLength() and GetArrayElement() to access the members of the array and then serialize them.
schema | The ArraySchema for serialization |
value | The value being serialized |
encoder | The encoder for serialization |
abstract WriteItem Avro.Generic.PreresolvingDatumWriter< T >.ResolveEnum | ( | EnumSchema | es | ) | [protected, pure virtual] |
Serializes an enumeration.
es | The EnumSchema for serialization |
Implemented in Avro.Generic.GenericDatumWriter< T >, and Avro.Specific.SpecificDatumWriter< T >.
int Avro.Generic.PreresolvingDatumWriter< T >.ResolveUnion | ( | UnionSchema | us, |
Schema[] | branchSchemas, | ||
object | obj | ||
) | [inline, protected] |
Finds the branch within the given UnionSchema that matches the given object. The default implementation calls Matches() method in the order of branches within the UnionSchema. If nothing matches, throws an exception.
us | The UnionSchema to resolve against |
obj | The object that should be used in matching |
void Avro.Generic.PreresolvingDatumWriter< T >.Write< S > | ( | object | value, |
Schema.Type | tag, | ||
Writer< S > | writer | ||
) | [inline, protected] |
A generic method to serialize primitive Avro types.
S | Type of the C# type to be serialized |
value | The value to be serialized |
tag | The schema type tag |
writer | The writer which should be used to write the given type. |
abstract void Avro.Generic.PreresolvingDatumWriter< T >.WriteField | ( | object | record, |
string | fieldName, | ||
int | fieldPos, | ||
WriteItem | writer, | ||
Encoder | encoder | ||
) | [protected, pure virtual] |
Extracts the field value from the given object.
value | The record value from which the field needs to be extracted |
fieldName | The name of the field in the record |
fieldPos | The position of field in the record |
Implemented in Avro.Generic.GenericDatumWriter< T >, and Avro.Specific.SpecificDatumWriter< T >.
abstract void Avro.Generic.PreresolvingDatumWriter< T >.WriteFixed | ( | FixedSchema | es, |
object | value, | ||
Encoder | encoder | ||
) | [protected, pure virtual] |
Serialized a fixed object. The default implementation requires that the value is a GenericFixed object with an identical schema as es.
es | The schema for serialization |
value | The value to be serialized |
encoder | The encoder for serialization |
Implemented in Avro.Specific.SpecificDatumWriter< T >, and Avro.Generic.GenericDatumWriter< T >.
void Avro.Generic.PreresolvingDatumWriter< T >.WriteMap | ( | WriteItem | itemWriter, |
object | value, | ||
Encoder | encoder | ||
) | [inline, protected] |
Serialized a map. The default implementation first ensure that the value is indeed a map and then uses GetMapSize() and GetMapElements() to access the contents of the map.
schema | The MapSchema for serialization |
value | The value to be serialized |
encoder | The encoder for serialization |
void Avro.Generic.PreresolvingDatumWriter< T >.WriteNull | ( | object | value, |
Encoder | encoder | ||
) | [inline, protected] |
Serializes a "null".
value | The object to be serialized using null schema |
encoder | The encoder to use while serialization |