Class CompactValue

  • All Implemented Interfaces:

    public class CompactValue
    extends Struct
    Unstable/private API.


     struct CompactValue {
         union {
             float value;
             uint32_t repr;
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • VALUE, REPR

        The struct member offsets.
    • Constructor Detail

      • CompactValue

        public CompactValue​(java.nio.ByteBuffer container)
        Creates a CompactValue instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • value

        public float value()
        Returns the value of the value field.
      • repr

        public int repr()
        Returns the value of the repr field.
      • create

        public static CompactValue create​(long address)
        Returns a new CompactValue instance for the specified memory address.
      • createSafe

        public static CompactValue createSafe​(long address)
        Like create, but returns null if address is NULL.
      • create

        public static CompactValue.Buffer create​(long address,
                                                 int capacity)
        Create a CompactValue.Buffer instance at the specified memory.
        address - the memory address
        capacity - the buffer capacity
      • createSafe

        public static CompactValue.Buffer createSafe​(long address,
                                                     int capacity)
        Like create, but returns null if address is NULL.
      • nvalue

        public static float nvalue​(long struct)
        Unsafe version of value().
      • nrepr

        public static int nrepr​(long struct)
        Unsafe version of repr().
      • decode

        public float decode()