Top Description Inners Methods
org.apache.avro.message

public Interface MessageDecoder<D>

Known Direct Implementers
org.apache.avro.message.MessageDecoder.BaseDecoder
Type Parameters
<D>
a datum class
Imports
org.apache.avro.util.ReusableByteArrayInputStream, .ReusableByteBufferInputStream, org.apache.avro.util.internal.ThreadLocalWithInitial, java.io.IOException, .InputStream, java.nio.ByteBuffer

Deserializes a single datum from a ByteBuffer, byte array, or InputStream.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
MessageDecoder.BaseDecoder<
a datum class
D
>

Base class for MessageEncoder implementations that provides default implementations for most of the DatumEncoder API.

Method Summary

Modifier and TypeMethod and Description
public D

Returns:

a datum read from the stream
decode
(InputStream
stream to read from
stream
)

Deserialize a single datum from an InputStream.

public D

Returns:

a datum read from the stream
decode
(InputStream
stream to read from
stream
,
D
a datum instance to reuse, avoiding instantiation if possible
reuse
)

Deserialize a single datum from an InputStream.

public D

Returns:

a datum read from the stream
decode
(ByteBuffer
a ByteBuffer containing an encoded datum
encoded
)

Deserialize a single datum from a ByteBuffer.

public D

Returns:

a datum read from the stream
decode
(ByteBuffer
a ByteBuffer containing an encoded datum
encoded
,
D
a datum instance to reuse, avoiding instantiation if possible
reuse
)

Deserialize a single datum from a ByteBuffer.

public D

Returns:

a datum read from the stream
decode
(byte[]
a byte array containing an encoded datum
encoded
)

Deserialize a single datum from a byte array.

public D

Returns:

a datum read from the stream
decode
(byte[]
a byte array containing an encoded datum
encoded
,
D
a datum instance to reuse, avoiding instantiation if possible
reuse
)

Deserialize a single datum from a byte array.

Method Detail

decodeback to summary
public D decode(InputStream stream) throws IOException

Deserialize a single datum from an InputStream.

Parameters
stream:InputStream

stream to read from

Returns:D

a datum read from the stream

Exceptions
BadHeaderException:
If the payload's header is not recognized.
MissingSchemaException:
If the payload's schema cannot be found.
decodeback to summary
public D decode(InputStream stream, D reuse) throws IOException

Deserialize a single datum from an InputStream.

Parameters
stream:InputStream

stream to read from

reuse:D

a datum instance to reuse, avoiding instantiation if possible

Returns:D

a datum read from the stream

Exceptions
BadHeaderException:
If the payload's header is not recognized.
MissingSchemaException:
If the payload's schema cannot be found.
decodeback to summary
public D decode(ByteBuffer encoded) throws IOException

Deserialize a single datum from a ByteBuffer.

Parameters
encoded:ByteBuffer

a ByteBuffer containing an encoded datum

Returns:D

a datum read from the stream

Exceptions
BadHeaderException:
If the payload's header is not recognized.
MissingSchemaException:
If the payload's schema cannot be found.
decodeback to summary
public D decode(ByteBuffer encoded, D reuse) throws IOException

Deserialize a single datum from a ByteBuffer.

Parameters
encoded:ByteBuffer

a ByteBuffer containing an encoded datum

reuse:D

a datum instance to reuse, avoiding instantiation if possible

Returns:D

a datum read from the stream

Exceptions
BadHeaderException:
If the payload's header is not recognized.
MissingSchemaException:
If the payload's schema cannot be found.
decodeback to summary
public D decode(byte[] encoded) throws IOException

Deserialize a single datum from a byte array.

Parameters
encoded:byte[]

a byte array containing an encoded datum

Returns:D

a datum read from the stream

Exceptions
BadHeaderException:
If the payload's header is not recognized.
MissingSchemaException:
If the payload's schema cannot be found.
decodeback to summary
public D decode(byte[] encoded, D reuse) throws IOException

Deserialize a single datum from a byte array.

Parameters
encoded:byte[]

a byte array containing an encoded datum

reuse:D

a datum instance to reuse, avoiding instantiation if possible

Returns:D

a datum read from the stream

Exceptions
BadHeaderException:
If the payload's header is not recognized.
MissingSchemaException:
If the payload's schema cannot be found.
org.apache.avro.message back to summary

public abstract Class MessageDecoder.BaseDecoder<D>

extends Object
implements MessageDecoder<D>
Class Inheritance
All Implemented Interfaces
org.apache.avro.message.MessageDecoder
Known Direct Subclasses
org.apache.avro.message.RawMessageDecoder, org.apache.avro.message.BinaryMessageDecoder
Type Parameters
<D>
a datum class

Base class for MessageEncoder implementations that provides default implementations for most of the DatumEncoder API.

Implementations provided by this base class are thread-safe.

Field Summary

Modifier and TypeField and Description
private static final ThreadLocal<ReusableByteArrayInputStream>
private static final ThreadLocal<ReusableByteBufferInputStream>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public D
decode(InputStream
stream to read from
stream
)

Implements org.apache.avro.message.MessageDecoder.decode.

Deserialize a single datum from an InputStream.
public D
decode(ByteBuffer
a ByteBuffer containing an encoded datum
encoded
)

Implements org.apache.avro.message.MessageDecoder.decode.

Deserialize a single datum from a ByteBuffer.
public D
decode(byte[]
a byte array containing an encoded datum
encoded
)

Implements org.apache.avro.message.MessageDecoder.decode.

Deserialize a single datum from a byte array.
public D
decode(ByteBuffer
a ByteBuffer containing an encoded datum
encoded
,
D
a datum instance to reuse, avoiding instantiation if possible
reuse
)

Implements org.apache.avro.message.MessageDecoder.decode.

Deserialize a single datum from a ByteBuffer.
public D
decode(byte[]
a byte array containing an encoded datum
encoded
,
D
a datum instance to reuse, avoiding instantiation if possible
reuse
)

Implements org.apache.avro.message.MessageDecoder.decode.

Deserialize a single datum from a byte array.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BYTE_ARRAY_INback to summary
private static final ThreadLocal<ReusableByteArrayInputStream> BYTE_ARRAY_IN
BYTE_BUFFER_INback to summary
private static final ThreadLocal<ReusableByteBufferInputStream> BYTE_BUFFER_IN

Constructor Detail

BaseDecoderback to summary
public BaseDecoder()

Method Detail

decodeback to summary
public D decode(InputStream stream) throws IOException

Implements org.apache.avro.message.MessageDecoder.decode.

Doc from org.apache.avro.message.MessageDecoder.decode.

Deserialize a single datum from an InputStream.

Parameters
stream:InputStream

stream to read from

Returns:D

a datum read from the stream

Annotations
@Override
decodeback to summary
public D decode(ByteBuffer encoded) throws IOException

Implements org.apache.avro.message.MessageDecoder.decode.

Doc from org.apache.avro.message.MessageDecoder.decode.

Deserialize a single datum from a ByteBuffer.

Parameters
encoded:ByteBuffer

a ByteBuffer containing an encoded datum

Returns:D

a datum read from the stream

Annotations
@Override
decodeback to summary
public D decode(byte[] encoded) throws IOException

Implements org.apache.avro.message.MessageDecoder.decode.

Doc from org.apache.avro.message.MessageDecoder.decode.

Deserialize a single datum from a byte array.

Parameters
encoded:byte[]

a byte array containing an encoded datum

Returns:D

a datum read from the stream

Annotations
@Override
decodeback to summary
public D decode(ByteBuffer encoded, D reuse) throws IOException

Implements org.apache.avro.message.MessageDecoder.decode.

Doc from org.apache.avro.message.MessageDecoder.decode.

Deserialize a single datum from a ByteBuffer.

Parameters
encoded:ByteBuffer

a ByteBuffer containing an encoded datum

reuse:D

a datum instance to reuse, avoiding instantiation if possible

Returns:D

a datum read from the stream

Annotations
@Override
decodeback to summary
public D decode(byte[] encoded, D reuse) throws IOException

Implements org.apache.avro.message.MessageDecoder.decode.

Doc from org.apache.avro.message.MessageDecoder.decode.

Deserialize a single datum from a byte array.

Parameters
encoded:byte[]

a byte array containing an encoded datum

reuse:D

a datum instance to reuse, avoiding instantiation if possible

Returns:D

a datum read from the stream

Annotations
@Override