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
Modifier and TypeInterfaceDescriptionstatic class
Base class forMessageEncoder
implementations that provides default implementations for most of theDatumEncoder
API. -
Method Summary
Modifier and TypeMethodDescriptiondecode
(byte[] encoded) Deserialize a single datum from a byte array.Deserialize a single datum from a byte array.decode
(InputStream stream) Deserialize a single datum from an InputStream.decode
(InputStream stream, D reuse) Deserialize a single datum from an InputStream.decode
(ByteBuffer encoded) Deserialize a single datum from a ByteBuffer.decode
(ByteBuffer encoded, D reuse) Deserialize a single datum from a ByteBuffer.
-
Method Details
-
decode
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
Deserialize a single datum from an InputStream.- Parameters:
stream
- stream to read fromreuse
- 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
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
Deserialize a single datum from a ByteBuffer.- Parameters:
encoded
- a ByteBuffer containing an encoded datumreuse
- 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
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
Deserialize a single datum from a byte array.- Parameters:
encoded
- a byte array containing an encoded datumreuse
- 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
-