org.apache.avro.message

## Class MessageDecoder.BaseDecoder<D>

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

Type Parameters:
  `D` - a datum class

All Implemented Interfaces:
  MessageDecoder<D>

Direct Known Subclasses:
  BinaryMessageDecoder, RawMessageDecoder

Enclosing interface:
  MessageDecoder<D>

    public abstract static class MessageDecoder.BaseDecoder<D>
    extends Object
    implements MessageDecoder<D>

Base class for `MessageEncoder` implementations that provides default implementations for most of the `DatumEncoder` API.

Implementations provided by this base class are 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
`BaseDecoder()`

### Method Summary

All Methods Instance Methods Concrete Methods
`D` `decode(byte[] encoded)` Deserialize a single datum from a byte array.
`D` `decode(byte[] encoded, D reuse)` Deserialize a single datum from a byte array.
`D` `decode(ByteBuffer encoded)` Deserialize a single datum from a ByteBuffer.
`D` `decode(ByteBuffer encoded, D reuse)` Deserialize a single datum from a ByteBuffer.
`D` `decode(InputStream stream)` Deserialize a single datum from an InputStream.

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

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

### Methods inherited from interface org.apache.avro.message.MessageDecoder

`decode`

### Constructor Detail

#### BaseDecoder

    public BaseDecoder()

### Method Detail

#### decode

    public D decode(InputStream stream)
             throws IOException

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

Specified by:
  `decode` in interface `MessageDecoder<D>`
Parameters:
  `stream` - stream to read from
Returns:
  a datum read from the stream
Throws:
  `IOException`

#### decode

    public D decode(ByteBuffer encoded)
             throws IOException

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

Specified by:
  `decode` in interface `MessageDecoder<D>`
Parameters:
  `encoded` - a ByteBuffer containing an encoded datum
Returns:
  a datum read from the stream
Throws:
  `IOException`

#### decode

    public D decode(byte[] encoded)
             throws IOException

Description copied from interface: `MessageDecoder`
Deserialize a single datum from a byte array.

Specified by:
  `decode` in interface `MessageDecoder<D>`
Parameters:
  `encoded` - a byte array containing an encoded datum
Returns:
  a datum read from the stream
Throws:
  `IOException`

#### decode

    public D decode(ByteBuffer encoded,
                    D reuse)
             throws IOException

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

Specified by:
  `decode` in interface `MessageDecoder<D>`
Parameters:
  `encoded` - a ByteBuffer containing an encoded datum
  `reuse` - a datum instance to reuse, avoiding instantiation if possible
Returns:
  a datum read from the stream
Throws:
  `IOException`

#### decode

    public D decode(byte[] encoded,
                    D reuse)
             throws IOException

Description copied from interface: `MessageDecoder`
Deserialize a single datum from a byte array.

Specified by:
  `decode` in interface `MessageDecoder<D>`
Parameters:
  `encoded` - a byte array containing an encoded datum
  `reuse` - a datum instance to reuse, avoiding instantiation if possible
Returns:
  a datum read from the stream
Throws:
  `IOException`