Class ProductData.Byte

  • All Implemented Interfaces:
    Cloneable
    Direct Known Subclasses:
    ProductData.ASCII, ProductData.UByte
    Enclosing class:
    ProductData

    public static class ProductData.Byte
    extends ProductData
    The Byte class is a ProductData specialisation for signed 8-bit integer fields.

    Internally, data is stored in an array of the type byte[].

    • Field Detail

      • _array

        protected byte[] _array
        The internal data array holding this value's data elements.
    • Constructor Detail

      • Byte

        public Byte​(int numElems)
        Constructs a new signed byte value.
        Parameters:
        numElems - the number of elements, must not be less than one
      • Byte

        public Byte​(byte[] array)
        Constructs a new signed byte value.
        Parameters:
        array - the elements
      • Byte

        protected Byte​(int numElems,
                       int type)
        Constructs a new signed byte value.
        Parameters:
        numElems - the number of elements, must not be less than one
        type - must be one of TYPE_UINT8, TYPE_INT8 or TYPE_ASCII
      • Byte

        protected Byte​(int numElems,
                       boolean unsigned)
        Constructs a new signed byte value.
        Parameters:
        numElems - the number of elements, must not be less than one
        unsigned - if true an unsigned value type is constructed
      • Byte

        protected Byte​(byte[] array,
                       boolean unsigned)
        Constructs a new signed byte value.
        Parameters:
        array - the elements
        unsigned - if true an unsigned value type is constructed
      • Byte

        protected Byte​(byte[] array,
                       int type)
        Constructs a new signed byte value.
        Parameters:
        array - the elements
        type - must be one of TYPE_UINT8, TYPE_INT8 or TYPE_ASCII
    • Method Detail

      • createDeepClone

        protected ProductData createDeepClone()
        Retuns a "deep" copy of this product data.
        Specified by:
        createDeepClone in class ProductData
        Returns:
        a copy of this product data
      • getNumElems

        public int getNumElems()
        Returns the number of data elements this value has.
        Specified by:
        getNumElems in class ProductData
      • getArray

        public final byte[] getArray()
        Returns the internal data array holding this value's data elements.
        Returns:
        the internal data array, never null
      • getElems

        public Object getElems()
        Gets the actual value value(s). The value returned can safely been casted to an array object of the type byte[].
        Specified by:
        getElems in class ProductData
        Returns:
        this value's value, always a byte[], never null
      • setElems

        public void setElems​(Object data)
        Sets the data of this value. The data must be an array of the type byte[] or String[] and have a length that is equal to the value returned by the getNumDataElems method.
        Specified by:
        setElems in class ProductData
        Parameters:
        data - the data array
        Throws:
        IllegalArgumentException - if data is null or it is not an array of the required type or does not have the required array length.
      • dispose

        public void dispose()
        Releases all of the resources used by this object instance and all of its owned children. Its primary use is to allow the garbage collector to perform a vanilla job.

        This method should be called only if it is for sure that this object instance will never be used again. The results of referencing an instance of this class after a call to dispose() are undefined.

        Overrides of this method should always call super.dispose(); after disposing this instance.

        Specified by:
        dispose in class ProductData