Package org.apache.avro.message

# Interface MessageDecoder<D>

Type Parameters:
  `D` - a datum class

All Known Implementing Classes:
  `BinaryMessageDecoder`, `MessageDecoder.BaseDecoder`, `RawMessageDecoder`

public interface MessageDecoder<D>
Deserializes a single datum from a ByteBuffer, byte array, or InputStream.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static class`
`MessageDecoder.BaseDecoder<D>`
Base class for `MessageEncoder` implementations that provides default implementations for most of the `DatumEncoder` API.

## Method Summary

Modifier and Type
Method
Description
`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(InputStream stream)`
Deserialize a single datum from an InputStream.
`D`
`decode(InputStream stream, D reuse)`
Deserialize a single datum from an InputStream.
`D`
`decode(ByteBuffer encoded)`
Deserialize a single datum from a ByteBuffer.
`D`
`decode(ByteBuffer encoded, D reuse)`
Deserialize a single datum from a ByteBuffer.

## Method Details

### decode

D decode(InputStream stream) throws IOException
Deserialize a single datum from an InputStream.

Parameters:
  `stream` - stream to read from
Returns:
  a datum read from the stream
Throws:
  `BadHeaderException` - If the payload's header is not recognized.
  `MissingSchemaException` - If the payload's schema cannot be found.
  `IOException`

### decode

D decode(InputStream stream, D reuse) throws IOException
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
Throws:
  `BadHeaderException` - If the payload's header is not recognized.
  `MissingSchemaException` - If the payload's schema cannot be found.
  `IOException`

### decode

D decode(ByteBuffer encoded) throws IOException
Deserialize a single datum from a ByteBuffer.

Parameters:
  `encoded` - a ByteBuffer containing an encoded datum
Returns:
  a datum read from the stream
Throws:
  `BadHeaderException` - If the payload's header is not recognized.
  `MissingSchemaException` - If the payload's schema cannot be found.
  `IOException`

### decode

D decode(ByteBuffer encoded, D reuse) throws IOException
Deserialize a single datum from a ByteBuffer.

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:
  `BadHeaderException` - If the payload's header is not recognized.
  `MissingSchemaException` - If the payload's schema cannot be found.
  `IOException`

### decode

D decode(byte[] encoded) throws IOException
Deserialize a single datum from a byte array.

Parameters:
  `encoded` - a byte array containing an encoded datum
Returns:
  a datum read from the stream
Throws:
  `BadHeaderException` - If the payload's header is not recognized.
  `MissingSchemaException` - If the payload's schema cannot be found.
  `IOException`

### decode

D decode(byte[] encoded, D reuse) throws IOException
Deserialize a single datum from a byte array.

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:
  `BadHeaderException` - If the payload's header is not recognized.
  `MissingSchemaException` - If the payload's schema cannot be found.
  `IOException`