Class DataSerializer.NullableDataSerializer<T>

java.lang.Object
ru.progrm_jarvis.javacommons.data.DataSerializer.NullableDataSerializer<T>
All Implemented Interfaces:
DataSerializer<@Nullable T>
Enclosing interface:
DataSerializer<T>

public static final class DataSerializer.NullableDataSerializer<T> extends Object implements DataSerializer<@Nullable T>
Data serializer for nullable types.
  • Method Details

    • write

      public void write(@NotNull @NotNull DataOutputStream output, @Nullable T object) throws IOException
      Description copied from interface: DataSerializer
      Writes the object into the given output stream.
      Specified by:
      write in interface DataSerializer<T>
      Parameters:
      output - output in which the output should be written
      object - object to be written into the output stream
      Throws:
      IOException - if an error happens while writing
    • read

      @Nullable public T read(@NotNull @NotNull DataInputStream input) throws IOException
      Description copied from interface: DataSerializer
      Reads the object from the given input stream.
      Specified by:
      read in interface DataSerializer<T>
      Parameters:
      input - input from which the object should be read
      Returns:
      read object
      Throws:
      IOException - if an error happens while reading