org.apache.avro.protobuf

## Class ProtobufDatumReader<T>

- java.lang.Object
- - org.apache.avro.generic.GenericDatumReader<T>
  - - org.apache.avro.protobuf.ProtobufDatumReader<T>

- All Implemented Interfaces:
    DatumReader<T>

      public class ProtobufDatumReader<T>
      extends GenericDatumReader<T>

  `DatumReader` for generated Protobuf classes.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `ProtobufDatumReader()`
    `` | `ProtobufDatumReader(Class<T> c)`
    `` | `ProtobufDatumReader(Schema schema)` Construct where the writer's and reader's schemas are the same.
    `` | `ProtobufDatumReader(Schema writer, Schema reader)` Construct given writer's and reader's schema.
    `protected` | `ProtobufDatumReader(Schema writer, Schema reader, ProtobufData data)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Object` | `createEnum(String symbol, Schema schema)` Called to create an enum value.
    `protected Object` | `readBytes(Object old, Decoder in)` Called to read byte arrays.
    `protected Object` | `readRecord(Object old, Schema expected, ResolvingDecoder in)` Called to read a record instance.

    - ### Methods inherited from class org.apache.avro.generic.GenericDatumReader

      `addToArray, addToMap, convert, createBytes, createFixed, createFixed, createString, findStringClass, getData, getExpected, getResolver, getSchema, newArray, newInstanceFromString, newMap, newRecord, peekArray, read, read, readArray, readBytes, readEnum, readField, readFixed, readInt, readMap, readMapKey, readString, readString, readWithConversion, readWithoutConversion, setExpected, setSchema, skip`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ProtobufDatumReader

          public ProtobufDatumReader()

    - #### ProtobufDatumReader

          public ProtobufDatumReader(Class<T> c)

    - #### ProtobufDatumReader

          public ProtobufDatumReader(Schema schema)

      Construct where the writer's and reader's schemas are the same.

    - #### ProtobufDatumReader

          public ProtobufDatumReader(Schema writer,
                                     Schema reader)

      Construct given writer's and reader's schema.

    - #### ProtobufDatumReader

          protected ProtobufDatumReader(Schema writer,
                                        Schema reader,
                                        ProtobufData data)

  - ### Method Detail

    - #### readRecord

          protected Object readRecord(Object old,
                                      Schema expected,
                                      ResolvingDecoder in)
                               throws IOException

      Description copied from class: `GenericDatumReader`
      Called to read a record instance. May be overridden for alternate record representations.
      Overrides:
        `readRecord` in class `GenericDatumReader<T>`
      Throws:
        `IOException`

    - #### createEnum

          protected Object createEnum(String symbol,
                                      Schema schema)

      Description copied from class: `GenericDatumReader`
      Called to create an enum value. May be overridden for alternate enum representations. By default, returns a GenericEnumSymbol.
      Overrides:
        `createEnum` in class `GenericDatumReader<T>`

    - #### readBytes

          protected Object readBytes(Object old,
                                     Decoder in)
                              throws IOException

      Description copied from class: `GenericDatumReader`
      Called to read byte arrays. Subclasses may override to use a different byte array representation. By default, this calls `Decoder.readBytes(ByteBuffer)`.
      Overrides:
        `readBytes` in class `GenericDatumReader<T>`
      Throws:
        `IOException`

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.