org.apache.avro.message

## Class RawMessageDecoder<D>

- java.lang.Object
- - org.apache.avro.message.MessageDecoder.BaseDecoder<D>
  - - org.apache.avro.message.RawMessageDecoder<D>

All Implemented Interfaces:
  MessageDecoder<D>

    public class RawMessageDecoder<D>
    extends MessageDecoder.BaseDecoder<D>

A `MessageDecoder` that deserializes from raw datum bytes.

This class uses the schema passed to its constructor when decoding buffers. To decode buffers that have different schemas, use `BinaryMessageEncoder` and `BinaryMessageDecoder`.

This will not throw `BadHeaderException` because it expects no header, and will not throw `MissingSchemaException` because it always uses the read schema from its constructor.

This class is thread-safe.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.avro.message.MessageDecoder

`MessageDecoder.BaseDecoder<D>`

### Constructor Summary

Constructors
Constructor and Description
`RawMessageDecoder(GenericData model, Schema schema)` Creates a new `RawMessageDecoder` that uses the given `data model` to construct datum instances described by the `schema`.
`RawMessageDecoder(GenericData model, Schema writeSchema, Schema readSchema)` Creates a new `RawMessageDecoder` that uses the given `data model` to construct datum instances described by the `readSchema`.

### Method Summary

All Methods Instance Methods Concrete Methods
`D` `decode(InputStream stream, D reuse)` Deserialize a single datum from an InputStream.

### Methods inherited from class org.apache.avro.message.MessageDecoder.BaseDecoder

`decode, decode, decode, decode, decode`

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

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

### Constructor Detail

#### RawMessageDecoder

    public RawMessageDecoder(GenericData model,
                             Schema schema)

Creates a new `RawMessageDecoder` that uses the given `data model` to construct datum instances described by the `schema`.

The `schema` is used as both the expected schema (read schema) and for the schema of payloads that are decoded (written schema).

Parameters:
  `model` - the `data model` for datum instances
  `schema` - the `Schema` used to construct datum instances and to decode buffers.

#### RawMessageDecoder

    public RawMessageDecoder(GenericData model,
                             Schema writeSchema,
                             Schema readSchema)

Creates a new `RawMessageDecoder` that uses the given `data model` to construct datum instances described by the `readSchema`.

The `readSchema` is used for the expected schema and the `writeSchema` is the schema used to decode buffers. The `writeSchema` must be the schema that was used to encode all buffers decoded by this class.

Parameters:
  `model` - the `data model` for datum instances
  `readSchema` - the `Schema` used to construct datum instances
  `writeSchema` - the `Schema` used to decode buffers

### Method Detail

#### decode

    public D decode(InputStream stream,
                    D reuse)

Description copied from interface: `MessageDecoder`
Deserialize a single datum from an InputStream.

Parameters:
  `stream` - stream to read from
  `reuse` - a datum instance to reuse, avoiding instantiation if possible
Returns:
  a datum read from the stream