Interface Serializer<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      T fromBytes​(byte[] serializedValue)
      De-serializes a value from a given byte array.
      byte[] toBytes​(T value)
      Serializes a given value into a byte array.
    • Method Detail

      • toBytes

        byte[] toBytes​(T value)
        Serializes a given value into a byte array.
        Parameters:
        value - a value to serialize, must not be null
        Returns:
        a byte array containing a serialized value
        Throws:
        NullPointerException - if value is null
      • fromBytes

        T fromBytes​(byte[] serializedValue)
        De-serializes a value from a given byte array.
        Parameters:
        serializedValue - an array containing a serialized value of type T, must not be null
        Returns:
        a value
        Throws:
        NullPointerException - if the array is null
        IllegalArgumentException - if the array cannot be decoded into a value of type T (e.g., contains 2 bytes when 4 are expected)