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

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and 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 Detail

    - #### 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`

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