Interface DataBufable

All Known Implementing Classes:
ChunkSessionInformation

public interface DataBufable
Represents an object which can be written into a DataBuf but not using the default way the object mapper takes. Therefore, this class provides the traditional read and write methods to (de-) serialize an object from a DataBuf.

A class which implements this interface is required to contain a no-args constructor which contains no special logic for the data reader to create an empty instance of it. The data of the buffer is then filled in using the read method.

Since:
4.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Reads all data of this object from the given buffer.
    void
    Writes all needed data from this object into the given data buf.
  • Method Details

    • writeData

      void writeData(@NonNull DataBuf.Mutable dataBuf)
      Writes all needed data from this object into the given data buf.
      Parameters:
      dataBuf - the buffer to write the data to.
      Throws:
      NullPointerException - if the given buffer is null.
    • readData

      void readData(@NonNull @NonNull DataBuf dataBuf)
      Reads all data of this object from the given buffer. The deserializer uses the no-args constructor which must be available in this class and creates an empty instance of this class. This method is then responsible to fill the object data.

      The given buffer should NEVER be read from more than written into the buffer in the write method.

      Parameters:
      dataBuf - the data buf to read the class data from.
      Throws:
      NullPointerException - if the given buffer is null.