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.

  • Constructor Details

    • BaseDecoder

      public BaseDecoder()
  • Method Details

    • 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