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.

@FunctionalInterface public interface Serializer<T>
Serialize from Serializer to Buffer.
  • Method Details

    • serialize

      void serialize(T toSerialize, BufferAllocator allocator, Buffer buffer)
      Serialize the Serializer parameter to the Buffer parameter.
      Parameters:
      toSerialize - The Serializer to serialize.
      allocator - Used to allocate intermediate Buffers if required.
      buffer - Where the results of the serialization will be written to.
    • serialize

      default Buffer serialize(T toSerialize, BufferAllocator allocator)
      Serialize the Serializer parameter to a Buffer.
      Parameters:
      toSerialize - The Serializer to serialize.
      allocator - Used to allocate the buffer to serialize to.
      Returns:
      The results of the serialization.