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 Bufferserialize(T toSerialize, BufferAllocator allocator) Serialize theSerializerparameter to aBuffer.voidserialize(T toSerialize, BufferAllocator allocator, Buffer buffer) Serialize theSerializerparameter to theBufferparameter.
-
Method Details
-
serialize
Serialize theSerializerparameter to theBufferparameter.- Parameters:
toSerialize- TheSerializerto serialize.allocator- Used to allocate intermediateBuffers if required.buffer- Where the results of the serialization will be written to.
-
serialize
Serialize theSerializerparameter to aBuffer.- Parameters:
toSerialize- TheSerializerto serialize.allocator- Used to allocate the buffer to serialize to.- Returns:
- The results of the serialization.
-