Interface ObjectStrategy<T>

    • Method Detail

      • getClazz

        Class<? extends T> getClazz()
      • fromByteBuffer

        @Nullable
        T fromByteBuffer​(ByteBuffer buffer,
                         int numBytes)
        Convert values from their underlying byte representation. Implementations of this method may change the given buffer's mark, or limit, and position. Implementations of this method may not store the given buffer in a field of the "deserialized" object, need to use ByteBuffer.slice(), ByteBuffer.asReadOnlyBuffer() or ByteBuffer.duplicate() in this case.
        Parameters:
        buffer - buffer to read value from
        numBytes - number of bytes used to store the value, starting at buffer.position()
        Returns:
        an object created from the given byte buffer representation
      • fromByteBufferSafe

        @Nullable
        default T fromByteBufferSafe​(ByteBuffer buffer,
                                     int numBytes)
        Convert values from their underlying byte representation, when the underlying bytes might be corrupted or maliciously constructed Implementations of this method absolutely must never perform any sun.misc.Unsafe based memory read or write operations from instructions contained in the data read from this buffer without first validating the data. If the data cannot be validated, all read and write operations from instructions in this data must be done directly with the ByteBuffer methods, or using SafeWritableMemory if Memory is employed to materialize the value. Implementations of this method may change the given buffer's mark, or limit, and position. Implementations of this method may not store the given buffer in a field of the "deserialized" object, need to use ByteBuffer.slice(), ByteBuffer.asReadOnlyBuffer() or ByteBuffer.duplicate() in this case.
        Parameters:
        buffer - buffer to read value from
        numBytes - number of bytes used to store the value, starting at buffer.position()
        Returns:
        an object created from the given byte buffer representation