Class ValueGetter


  • public abstract class ValueGetter
    extends java.lang.Object
    Allows reading values.
    Author:
    sbaumhekel
    • Constructor Detail

      • ValueGetter

        public ValueGetter​(ByteGetter data,
                           byte endian)
        Constructs an instance.
        Parameters:
        data - ByteGetter
        endian - endianess
    • Method Detail

      • getValueGetterForEndian

        public static ValueGetter getValueGetterForEndian​(ByteGetter bytes)
        Get the appropriate ValueGetter for the given endianness.
        Parameters:
        bytes - ByteGetter
        Returns:
        ValueGetter
        Throws:
        java.lang.IllegalArgumentException - if the endian type is unknown
      • getByte

        public byte getByte()
        Get a byte, should be equal for all endians
        Returns:
        the byte value
      • getDouble

        public double getDouble()
        Get a double.
        Returns:
        the double value
      • getEndian

        public int getEndian()
        Gets the endian encoding.
        Returns:
        endian encoding
      • getInt

        public int getInt()
        Get an integer.
        Returns:
        interger
      • getInt

        protected abstract int getInt​(int index)
        Get a 32-Bit integer
        Parameters:
        index - the index to get the value from
        Returns:
        the int value
      • getLong

        public long getLong()
        Get a long.
        Returns:
        long
      • getLong

        protected abstract long getLong​(int index)
        Get a long value. This is not needed directly, but as a nice side-effect from GetDouble.
        Parameters:
        index - the index to get the value from
        Returns:
        the long value