Interface ByteArrayMarshaller<T>

All Superinterfaces:
Marshaller<T,byte[]>

public interface ByteArrayMarshaller<T> extends Marshaller<T,byte[]>
The ByteArrayMarshaller interface is designed to marshal and unmarshal objects to and from byte arrays. If the byte[] is your preferred way of marshalling objects, you can implement this interface to provide custom marshalling logic.

The default implementation of the marshal method is plain java serialization.

  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> ByteArrayMarshaller<T>
     
    default byte @Nullable []
    marshal(T object)
    Marshal the object into raw type.
    default T
    unmarshal(byte @Nullable [] raw)
    Unmarshal the raw type into object.
  • Method Details

    • create

      static <T> ByteArrayMarshaller<T> create()
    • marshal

      default byte @Nullable [] marshal(@Nullable T object)
      Description copied from interface: Marshaller
      Marshal the object into raw type.
      Specified by:
      marshal in interface Marshaller<T,byte[]>
      Parameters:
      object - object to marshal.
      Returns:
      raw presentation of object.
    • unmarshal

      @Nullable default T unmarshal(byte @Nullable [] raw)
      Description copied from interface: Marshaller
      Unmarshal the raw type into object.
      Specified by:
      unmarshal in interface Marshaller<T,byte[]>
      Parameters:
      raw - raw presentation of object.
      Returns:
      object.