|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avro.generic.GenericDatumReader<D>
public class GenericDatumReader<D>
DatumReader
for generic Java objects.
Constructor Summary | |
---|---|
GenericDatumReader()
|
|
GenericDatumReader(Schema schema)
Construct where the writer's and reader's schemas are the same. |
|
GenericDatumReader(Schema writer,
Schema reader)
Construct given writer's and reader's schema. |
Method Summary | |
---|---|
protected void |
addToArray(Object array,
long pos,
Object e)
Called by the default implementation of readArray(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder) to add a
value. |
protected void |
addToMap(Object map,
Object key,
Object value)
Called by the default implementation of readMap(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder) to add a
key/value pair. |
protected Object |
createBytes(byte[] value)
Called to create byte arrays from default values. |
protected Object |
createEnum(String symbol,
Schema schema)
Called to create an enum value. |
protected Object |
createFixed(Object old,
byte[] bytes,
Schema schema)
Called to create an fixed value. |
protected Object |
createFixed(Object old,
Schema schema)
Called to create an fixed value. |
protected Object |
createString(String value)
Called to create a string from a default value. |
protected Object |
getField(Object record,
String name,
int position)
Called by the default implementation of readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder) to retrieve a
record field value from a reused instance. |
protected Object |
newArray(Object old,
int size,
Schema schema)
Called to create new array instances. |
protected Object |
newMap(Object old,
int size)
Called to create new array instances. |
protected Object |
newRecord(Object old,
Schema schema)
Called to create new record instances. |
protected Object |
peekArray(Object array)
Called by the default implementation of readArray(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder) to retrieve a
value from a reused instance. |
D |
read(D reuse,
Decoder in)
Read a datum. |
protected Object |
read(Object old,
Schema expected,
ResolvingDecoder in)
Called to read data. |
protected Object |
readArray(Object old,
Schema expected,
ResolvingDecoder in)
Called to read an array instance. |
protected Object |
readBytes(Object old,
Decoder in)
Called to read byte arrays. |
protected Object |
readEnum(Schema expected,
Decoder in)
Called to read an enum value. |
protected Object |
readFixed(Object old,
Schema expected,
Decoder in)
Called to read a fixed value. |
protected Object |
readInt(Object old,
Schema expected,
Decoder in)
Called to read integers. |
protected Object |
readMap(Object old,
Schema expected,
ResolvingDecoder in)
Called to read a map instance. |
protected Object |
readRecord(Object old,
Schema expected,
ResolvingDecoder in)
Called to read a record instance. |
protected Object |
readString(Object old,
Decoder in)
Called to read strings. |
protected Object |
readString(Object old,
Schema expected,
Decoder in)
Called to read strings. |
protected void |
removeField(Object record,
String field,
int position)
Called by the default implementation of readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder) to remove a
record field value from a reused instance. |
void |
setExpected(Schema reader)
Set the reader's schema. |
protected void |
setField(Object record,
String name,
int position,
Object o)
Called by the default implementation of readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder) to set a
record fields value to a record instance. |
void |
setSchema(Schema writer)
Set the writer's schema. |
static void |
skip(Schema schema,
Decoder in)
Skip an instance of a schema. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GenericDatumReader()
public GenericDatumReader(Schema schema)
public GenericDatumReader(Schema writer, Schema reader)
Method Detail |
---|
public void setSchema(Schema writer)
DatumReader
setSchema
in interface DatumReader<D>
public void setExpected(Schema reader) throws IOException
IOException
public D read(D reuse, Decoder in) throws IOException
DatumReader
read
in interface DatumReader<D>
IOException
protected Object read(Object old, Schema expected, ResolvingDecoder in) throws IOException
IOException
protected Object readRecord(Object old, Schema expected, ResolvingDecoder in) throws IOException
IOException
protected void setField(Object record, String name, int position, Object o)
readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)
to set a
record fields value to a record instance. The default implementation is
for IndexedRecord
.
protected Object getField(Object record, String name, int position)
readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)
to retrieve a
record field value from a reused instance. The default implementation is
for IndexedRecord
.
protected void removeField(Object record, String field, int position)
readRecord(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)
to remove a
record field value from a reused instance. The default implementation is
for GenericRecord
.
protected Object readEnum(Schema expected, Decoder in) throws IOException
IOException
protected Object createEnum(String symbol, Schema schema)
protected Object readArray(Object old, Schema expected, ResolvingDecoder in) throws IOException
IOException
protected Object peekArray(Object array)
readArray(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)
to retrieve a
value from a reused instance. The default implementation is for GenericArray
.
protected void addToArray(Object array, long pos, Object e)
readArray(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)
to add a
value. The default implementation is for Collection
.
protected Object readMap(Object old, Schema expected, ResolvingDecoder in) throws IOException
IOException
protected void addToMap(Object map, Object key, Object value)
readMap(java.lang.Object, org.apache.avro.Schema, org.apache.avro.io.ResolvingDecoder)
to add a
key/value pair. The default implementation is for Map
.
protected Object readFixed(Object old, Schema expected, Decoder in) throws IOException
GenericFixed
.
IOException
protected Object createFixed(Object old, Schema schema)
GenericFixed
.
protected Object createFixed(Object old, byte[] bytes, Schema schema)
GenericFixed
.
protected Object newRecord(Object old, Schema schema)
GenericData.Record
.
protected Object newArray(Object old, int size, Schema schema)
GenericData.Array
.
protected Object newMap(Object old, int size)
HashMap
.
protected Object readString(Object old, Schema expected, Decoder in) throws IOException
readString(Object,Decoder)
.
IOException
protected Object readString(Object old, Decoder in) throws IOException
Decoder.readString(Utf8)
.
IOException
protected Object createString(String value)
Utf8.Utf8(String)
.
protected Object readBytes(Object old, Decoder in) throws IOException
Decoder.readBytes(ByteBuffer)
.
IOException
protected Object readInt(Object old, Schema expected, Decoder in) throws IOException
Decoder.readInt()
.
IOException
protected Object createBytes(byte[] value)
ByteBuffer.wrap(byte[])
.
public static void skip(Schema schema, Decoder in) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |