Interface DataSerializer<T>

Type Parameters:
T - type of serialized data
All Known Implementing Classes:
DataSerializer.NullableDataSerializer, DataSerializer.OptionalDataSerializer

public interface DataSerializer<T>
Serializer of arbitary data.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Data serializer for nullable types.
    static final class 
    Data serializer for optional types.
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    fromByteArray(byte @NotNull [] byteArray)
    Reads the object from the given byte-array.
    default T
    fromByteArrayUnchecked(byte @NotNull [] byteArray)
    Reads the object from the given byte-array.
    default @NotNull DataSerializer<@Nullable T>
    Crates a data serializer based on this one which allows null values.
    default @NotNull DataSerializer<@NotNull Optional<T>>
    Crates a data serializer based on this one which allows optional values.
    read(@NotNull DataInputStream input)
    Reads the object from the given input stream.
    default T
    Reads the object from the given input stream.
    default byte @NotNull []
    toByteArray(T object)
    Converts the given object into a byte-array.
    default byte @NotNull []
    toByteArray(T object, @org.jetbrains.annotations.Range(from=1L, to=2147483647L) int expectedSize)
    Converts the given object into a byte-array.
    default byte @NotNull []
    Converts the given object into a byte-array.
    default byte @NotNull []
    toByteArrayUnchecked(T object, @org.jetbrains.annotations.Range(from=1L, to=2147483647L) int expectedSize)
    Converts the given object into a byte-array.
    void
    write(@NotNull DataOutputStream output, T object)
    Writes the object into the given output stream.
    default void
    writeUnchecked(@NotNull DataOutputStream output, T object)
    Writes the object into the given output stream.