AvroSerializer Interface

Implements

public interface AvroSerializer
extends ObjectSerializer

Generic interface covering basic Avro serialization and deserialization methods.

Method Summary

Modifier and Type Method and Description
abstract T deserialize(InputStream stream, TypeReference<T> typeReference)

Reads an Avro stream into its object representation.

abstract Mono<T> deserializeAsync(InputStream stream, TypeReference<T> typeReference)

Reads an Avro stream into its object representation.

default T deserializeFromBytes(byte[] data, TypeReference<T> typeReference)

Reads an Avro byte array into its object representation.

default Mono<T> deserializeFromBytesAsync(byte[] data, TypeReference<T> typeReference)

Reads an Avro byte array into its object representation.

abstract void serialize(OutputStream stream, Object value)

Writes an object's Avro representation into a stream.

abstract Mono<Void> serializeAsync(OutputStream stream, Object value)

Writes an object's Avro representation into a stream.

default byte[] serializeToBytes(Object value)

Converts the object into an Avro byte array.

default Mono<byte[]> serializeToBytesAsync(Object value)

Converts the object into a Avro byte array.

Method Details

deserialize

public abstract T <T>deserialize(InputStream stream, TypeReference<T> typeReference)

Reads an Avro stream into its object representation.

Parameters:

stream - Avro stream.
typeReference - TypeReference<T> representing the object.

Returns:

The object represented by the deserialized Avro stream.

deserializeAsync

public abstract Mono<T> <T>deserializeAsync(InputStream stream, TypeReference<T> typeReference)

Reads an Avro stream into its object representation.

Parameters:

stream - Avro stream.
typeReference - TypeReference<T> representing the object.

Returns:

Reactive stream that emits the object represented by the deserialized Avro stream.

deserializeFromBytes

public default T <T>deserializeFromBytes(byte[] data, TypeReference<T> typeReference)

Reads an Avro byte array into its object representation.

Parameters:

data - Avro byte array.
typeReference - TypeReference<T> representing the object.

Returns:

The object represented by the deserialized Avro byte array.

deserializeFromBytesAsync

public default Mono<T> <T>deserializeFromBytesAsync(byte[] data, TypeReference<T> typeReference)

Reads an Avro byte array into its object representation.

Parameters:

data - Avro byte array.
typeReference - TypeReference<T> representing the object.

Returns:

Reactive stream that emits the object represented by the deserialized Avro byte array.

serialize

public abstract void serialize(OutputStream stream, Object value)

Writes an object's Avro representation into a stream.

Parameters:

stream - OutputStream where the object's Avro representation will be written.
value - The object.

serializeAsync

public abstract Mono<Void> serializeAsync(OutputStream stream, Object value)

Writes an object's Avro representation into a stream.

Parameters:

stream - OutputStream where the object's Avro representation will be written.
value - The object.

Returns:

Reactive stream that will indicate operation completion.

serializeToBytes

public default byte[] serializeToBytes(Object value)

Converts the object into an Avro byte array.

Parameters:

value - The object.

Returns:

The Avro binary representation of the serialized object.

serializeToBytesAsync

public default Mono<byte[]> serializeToBytesAsync(Object value)

Converts the object into a Avro byte array.

Parameters:

value - The object.

Returns:

Reactive stream that emits the Avro binary representation of the serialized object.

Applies to