Compartir vía


ObjectSerializer Interface

public interface ObjectSerializer

Generic interface covering serializing and deserialization objects.

Method Summary

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

Reads a stream into its object representation.

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

Reads a stream into its object representation.

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

Reads a byte array into its object representation.

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

Reads a byte array into its object representation.

abstract void serialize(OutputStream stream, Object value)

Writes the serialized object into a stream.

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

Writes the serialized object into a stream.

default byte[] serializeToBytes(Object value)

Converts the object into a byte array.

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

Converts the object into a byte array.

Method Details

deserialize

public abstract T deserialize(InputStream stream, TypeReference typeReference)

Reads a stream into its object representation.

Parameters:

stream - InputStream of data.
typeReference - TypeReference<T> representing the object.

Returns:

The object represented by the deserialized stream.

deserializeAsync

public abstract Mono deserializeAsync(InputStream stream, TypeReference typeReference)

Reads a stream into its object representation.

Parameters:

stream - InputStream of data.
typeReference - TypeReference<T> representing the object.

Returns:

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

deserializeFromBytes

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

Reads a byte array into its object representation.

Parameters:

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

Returns:

The object represented by the deserialized byte array.

deserializeFromBytesAsync

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

Reads a byte array into its object representation.

Parameters:

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

Returns:

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

serialize

public abstract void serialize(OutputStream stream, Object value)

Writes the serialized object into a stream.

Parameters:

stream - OutputStream where the serialized object will be written.
value - The object.

serializeAsync

public abstract Mono serializeAsync(OutputStream stream, Object value)

Writes the serialized object into a stream.

Parameters:

stream - OutputStream where the serialized object 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 a byte array.

Parameters:

value - The object.

Returns:

The binary representation of the serialized object.

serializeToBytesAsync

public default Mono serializeToBytesAsync(Object value)

Converts the object into a byte array.

Parameters:

value - The object.

Returns:

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

Applies to