Interface Serializer<T>

  • All Known Implementing Classes:
    FunctionalSerializer, UUIDSerializer

    public interface Serializer<T>
    Writes/reads an object to/from a binary stream.
    Author:
    Paul Ferraro
    • Method Detail

      • write

        void write​(DataOutput output,
                   T value)
            throws IOException
        Writes the specified object to the specified output stream
        Parameters:
        output - the data output stream
        value - an object to serialize
        Throws:
        IOException - if an I/O error occurs
      • read

        T read​(DataInput input)
        throws IOException
        Reads an object from the specified input stream.
        Parameters:
        input - a data input stream
        Returns:
        the deserialized object
        Throws:
        IOException - if an I/O error occurs
      • size

        default OptionalInt size​(T object)
        Returns the size of the buffer to use for marshalling the specified object, if known.
        Returns:
        the buffer size (in bytes), or empty if unknown.