Class DataUtils

  • All Implemented Interfaces:
    DataTypesDefinition

    public class DataUtils
    extends Object
    implements DataTypesDefinition
    Class DataUtils.java is responsible for a bunch of miscellaneous operations for reading and converting data

    Created: Wed Jan 29 10:06:37 2003

    Author:
    Artur Hefczyc
    • Constructor Detail

      • DataUtils

        public DataUtils()
    • Method Detail

      • toBigEndian

        public static byte[] toBigEndian​(byte[] source)
        Converts the provided array to big endian.

        As java is BigEndian the implementation just makes a copy.

        Parameters:
        source - a byte[] value
        Returns:
        a byte[] value
      • decodeData

        public static Object decodeData​(byte[] bytes,
                                        char type)
        Describe decodeData method here.
        Parameters:
        bytes - a byte[] value
        type - a char value
        Returns:
        an Object value
      • copyArrays

        public static void copyArrays​(byte[] dest,
                                      byte[] source,
                                      int fromIdx)
        Describe copyArrays method here.
        Parameters:
        dest - a byte[] value
        source - a byte[] value
        fromIdx - an int value
      • decodeShort

        public static short decodeShort​(byte[] bytes)
        Describe decodeShort method here.
        Parameters:
        bytes - a byte[] value
        Returns:
        a short value
      • littleEndianToInt

        public static int littleEndianToInt​(byte[] fourBytes)
      • decodeInt

        public static int decodeInt​(byte[] bytes)
        Describe decodeInt method here.
        Parameters:
        bytes - a byte[] value
        Returns:
        an int value
      • decodeFloat

        public static float decodeFloat​(byte[] bytes)
        Describe decodeFloat method here.
        Parameters:
        bytes - a byte[] value
        Returns:
        a float value
      • decodeDouble

        public static double decodeDouble​(byte[] bytes)
        Describe decodeDouble method here.
        Parameters:
        bytes - a byte[] value
        Returns:
        a double value
      • unsigByteToInt

        public static int unsigByteToInt​(byte b)
        Describe unsigByteToInt method here.
        Parameters:
        b - a byte value
        Returns:
        an int value
      • getDataTypeSize

        public static int getDataTypeSize​(char type)
        Describe getDataTypeSize method here.
        Parameters:
        type - a char value
        Returns:
        an int value
      • isNumeric

        public static boolean isNumeric​(char type)
        Describe isNumeric method here.
        Parameters:
        type - a char value
        Returns:
        a boolean value