|
| | GenericDatumWriter (Schema schema) |
| | Initializes a new instance of the GenericDatumWriter<T> class.
|
|
void | EnsureArrayObject (object value) |
|
long | GetArrayLength (object value) |
|
void | WriteArrayValues (object array, WriteItem valueWriter, Encoder encoder) |
| void | Write (T datum, Encoder encoder) |
| | Write a datum. Traverse the schema, depth first, writing each leaf value in the schema from the datum to the output.- Parameters
-
| datum | Datum to write |
| encoder | Encoder to write to |
|
|
void | WriteEnum (object value) |
| | Obsolete - This will be removed from the public API in a future version.
|
| void | EnsureArrayObject (object value) |
| | Checks if the given object is an array. If it is a valid array, this function returns normally. Otherwise, it throws an exception. The default implementation checks if the value is an array.
|
| long | GetArrayLength (object value) |
| | Returns the length of an array. The default implementation requires the object to be an array of objects and returns its length. The default implementation guarantees that EnsureArrayObject() has been called on the value before this function is called.
|
| void | WriteArrayValues (object array, WriteItem valueWriter, Encoder encoder) |
| | Writes each value in the given array to the encoder using the valueWriter . The default implementation of this method requires that the array is an object array.
|
| void | EnsureMapObject (object value) |
| | Checks if the given object is a map. If it is a valid map, this function returns normally. Otherwise, it throws an exception. The default implementation checks if the value is an IDictionary<string, object>.
|
| long | GetMapSize (object value) |
| | Returns the size of the map object. The default implementation guarantees that EnsureMapObject has been successfully called with the given value. The default implementation requires the value to be an IDictionary<string, object> and returns the number of elements in it.
|
| void | WriteMapValues (object map, WriteItem valueWriter, Encoder encoder) |
| | Writes each value in the given map to the encoder using the valueWriter . The default implementation of this method requires that the map is an IDictionary<string, object>.
|
|
void | EnsureMapObject (object value) |
|
long | GetMapSize (object value) |
|
void | WriteMapValues (object map, WriteItem valueWriter, Encoder encoder) |
|
|
override void | WriteRecordFields (object recordObj, RecordFieldWriter[] writers, Encoder encoder) |
|
override void | EnsureRecordObject (RecordSchema recordSchema, object value) |
|
override void | WriteField (object record, string fieldName, int fieldPos, WriteItem writer, Encoder encoder) |
|
override WriteItem | ResolveEnum (EnumSchema es) |
|
override void | WriteFixed (FixedSchema es, object value, Encoder encoder) |
| override bool | UnionBranchMatches (Schema sc, object obj) |
| | Tests whether the given schema an object are compatible.
|
| delegate void | WriteItem (object value, Encoder encoder) |
| | Defines the signature for a method that writes a value to an encoder.
|
| | PreresolvingDatumWriter (Schema schema, ArrayAccess arrayAccess, MapAccess mapAccess) |
| | Initializes a new instance of the PreresolvingDatumWriter<T> class.
|
| void | WriteNull (object value, Encoder encoder) |
| | Serializes a "null".
|
| void | Write< TValue > (object value, Schema.Type tag, Writer< TValue > writer) |
| | A generic method to serialize primitive Avro types.
|
| void | WriteRecordFields (object record, RecordFieldWriter[] writers, Encoder encoder) |
| | Writes each field of a record to the encoder.
|
| void | EnsureRecordObject (RecordSchema recordSchema, object value) |
| | Ensures that the given value is a record and that it corresponds to the given schema. Throws an exception if either of those assertions are false.
|
| void | WriteField (object record, string fieldName, int fieldPos, WriteItem writer, Encoder encoder) |
| | Writes a field from the record to the encoder using the writer .
|
| WriteItem | ResolveEnum (EnumSchema es) |
| | Serializes an enumeration.
|
| WriteItem | ResolveArray (ArraySchema schema) |
| | Creates a WriteItem delegate that serializes 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.
|
| WriteItem | ResolveLogical (LogicalSchema schema) |
| | Serializes a logical value object by using the underlying logical type to convert the value to its base value.
|
| void | WriteMap (WriteItem itemWriter, object value, Encoder encoder) |
| | Serializes 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.
|
| 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.
|
| bool | UnionBranchMatches (Schema sc, object obj) |
| | Tests whether the given schema an object are compatible.
|
| override bool Avro.Generic.GenericDatumWriter< T >.UnionBranchMatches |
( |
Schema | sc, |
|
|
object | obj ) |
|
inlineprotected |
Tests whether the given schema an object are compatible.
FIXME: This method of determining the Union branch has problems. If the data is IDictionary<string, object> if there are two branches one with record schema and the other with map, it choose the first one. Similarly if the data is byte[] and there are fixed and bytes schemas as branches, it choose the first one that matches. Also it does not recognize the arrays of primitive types.
- Parameters
-
| sc | Schema to compare |
| obj | Object to compare |
- Returns
- True if the two parameters are compatible, false otherwise.