Package io.servicetalk.serializer.api
Interface Serializer<T>
- Type Parameters:
T
- The type of objects that can be serialized.
- All Known Subinterfaces:
SerializerDeserializer<T>
- All Known Implementing Classes:
ByteArraySerializer
,StringSerializer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Serialize from
Serializer
to Buffer
.-
Method Summary
Modifier and TypeMethodDescriptiondefault Buffer
serialize
(T toSerialize, BufferAllocator allocator) Serialize theSerializer
parameter to aBuffer
.void
serialize
(T toSerialize, BufferAllocator allocator, Buffer buffer) Serialize theSerializer
parameter to theBuffer
parameter.
-
Method Details
-
serialize
Serialize theSerializer
parameter to theBuffer
parameter.- Parameters:
toSerialize
- TheSerializer
to serialize.allocator
- Used to allocate intermediateBuffer
s if required.buffer
- Where the results of the serialization will be written to.
-
serialize
Serialize theSerializer
parameter to aBuffer
.- Parameters:
toSerialize
- TheSerializer
to serialize.allocator
- Used to allocate the buffer to serialize to.- Returns:
- The results of the serialization.
-