Package com.azure.core.util.serializer
Interface ObjectSerializer
- All Known Subinterfaces:
JsonSerializer
public interface ObjectSerializer
Generic interface covering serializing and deserialization objects.
-
Method Summary
Modifier and TypeMethodDescription<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.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
-
deserializeFromBytes
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
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
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
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
Converts the object into a byte array.- Parameters:
value
- The object.- Returns:
- The binary representation of the serialized object.
-
serialize
Writes the serialized object into a stream.- Parameters:
stream
-OutputStream
where the serialized object will be written.value
- The object.
-
serializeToBytesAsync
Converts the object into a byte array.- Parameters:
value
- The object.- Returns:
- Reactive stream that emits the binary representation of the serialized object.
-
serializeAsync
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.
-