Package org.apache.avro.message

# Interface MessageEncoder<D>

Type Parameters:
  `D` - a datum class

All Known Implementing Classes:
  `BinaryMessageEncoder`, `RawMessageEncoder`

public interface MessageEncoder<D>
Serializes an individual datum as a ByteBuffer or to an OutputStream.

## Method Summary

Modifier and Type
Method
Description
`ByteBuffer`
`encode(D datum)`
Serialize a single datum to a ByteBuffer.
`void`
`encode(D datum, OutputStream stream)`
Serialize a single datum to an OutputStream.

## Method Details

### encode

ByteBuffer encode(D datum) throws IOException
Serialize a single datum to a ByteBuffer.

Parameters:
  `datum` - a datum
Returns:
  a ByteBuffer containing the serialized datum
Throws:
  `IOException`

### encode

void encode(D datum, OutputStream stream) throws IOException
Serialize a single datum to an OutputStream.

Parameters:
  `datum` - a datum
  `stream` - an OutputStream to serialize the datum to
Throws:
  `IOException`