Package com.azure.core.util.serializer
Interface ObjectSerializer
-
- All Known Subinterfaces:
JsonSerializer
public interface ObjectSerializer
Generic interface covering serializing and deserialization objects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> T
deserialize(InputStream stream, TypeReference<T> typeReference)
Reads a stream into its object representation.<T> Mono<T>
deserializeAsync(InputStream stream, TypeReference<T> typeReference)
Reads a stream into its object representation.default <T> T
deserializeFromBytes(byte[] data, TypeReference<T> typeReference)
Reads a byte array into its object representation.default <T> Mono<T>
deserializeFromBytesAsync(byte[] data, TypeReference<T> typeReference)
Reads a byte array into its object representation.void
serialize(OutputStream stream, Object value)
Writes the serialized object into a stream.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 Detail
-
deserializeFromBytes
default <T> T deserializeFromBytes(byte[] data, TypeReference<T> typeReference)
Reads a byte array into its object representation.- Type Parameters:
T
- Type of the object.- Parameters:
data
- Byte array.typeReference
-TypeReference
representing the object.- Returns:
- The object represented by the deserialized byte array.
-
deserialize
<T> T deserialize(InputStream stream, TypeReference<T> typeReference)
Reads a stream into its object representation.- Type Parameters:
T
- Type of the object.- Parameters:
stream
-InputStream
of data.typeReference
-TypeReference
representing the object.- Returns:
- The object represented by the deserialized stream.
-
deserializeFromBytesAsync
default <T> Mono<T> deserializeFromBytesAsync(byte[] data, TypeReference<T> typeReference)
Reads a byte array into its object representation.- Type Parameters:
T
- Type of the object.- Parameters:
data
- Byte array.typeReference
-TypeReference
representing the object.- Returns:
- Reactive stream that emits the object represented by the deserialized byte array.
-
deserializeAsync
<T> Mono<T> deserializeAsync(InputStream stream, TypeReference<T> typeReference)
Reads a stream into its object representation.- Type Parameters:
T
- Type of the object.- Parameters:
stream
-InputStream
of data.typeReference
-TypeReference
representing the object.- Returns:
- Reactive stream that emits the object represented by the deserialized stream.
-
serializeToBytes
default byte[] serializeToBytes(Object value)
Converts the object into a byte array.- Parameters:
value
- The object.- Returns:
- The binary representation of the serialized object.
-
serialize
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.
-
serializeToBytesAsync
default Mono<byte[]> 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.
-
serializeAsync
Mono<Void> 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.
-
-