枚举 DataType

    • 方法详细资料

      • values

        public static DataType[] values()
        按照声明该枚举类型的常量的顺序, 返回 包含这些常量的数组。该方法可用于迭代 常量, 如下所示:
        for (DataType c : DataType.values())
            System.out.println(c);
        
        返回:
        按照声明该枚举类型的常量的顺序返回的包含这些常量的数组
      • valueOf

        public static DataType valueOf​(String name)
        返回带有指定名称的该类型的枚举常量。 字符串必须与用于声明该类型的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)
        参数:
        name - 要返回的枚举常量的名称。
        返回:
        返回带有指定名称的枚举常量
        抛出:
        IllegalArgumentException - 如果该枚举类型没有带有指定名称的常量
        NullPointerException - 如果参数为空值
      • toString

        public String toString()
        The DataType name, eg "byte", "float", "String".
        覆盖:
        toString 在类中 Enum<DataType>
        返回:
        The DataType name
      • getSize

        public int getSize()
        Size in bytes of one element of this data type. Strings dont know, so return 0. Structures return 1.
        返回:
        Size in bytes of one element of this data type.
      • getClassType

        public Class getClassType()
      • getPrimitiveClassType

        public Class getPrimitiveClassType()
        The primitive class type: char, byte, float, double, short, int, long, boolean, String, StructureData, StructureDataIterator, ByteBuffer.
        返回:
        the primitive class type
      • isUnsigned

        public boolean isUnsigned()
        Returns true if the data type is unsigned. For non-integral data types, it is guaranteed to be false.
        返回:
        true if the data type is unsigned.
      • getNumber

        public int getNumber()
        Returns A unique number for each of the different built-in types. These are roughly ordered from least-to-most precision.
        返回:
      • isString

        public boolean isString()
        Is String or Char
        返回:
        true if String or Char
      • isBoolean

        public boolean isBoolean()
        Is Boolean
        返回:
        true if Boolean
      • isNumeric

        public boolean isNumeric()
        Is Byte, Float, Double, Int, Short, or Long
        返回:
        true if numeric
      • isIntegral

        public boolean isIntegral()
        Is Byte, Int, Short, or Long
        返回:
        true if integral
      • isFloatingPoint

        public boolean isFloatingPoint()
        Is Float or Double
        返回:
        true if floating point type
      • isEnum

        public boolean isEnum()
        Is this an enumeration types?
        返回:
        true if ENUM1, 2, or 4
      • asNumber

        public Number asNumber​(Number n)
        Convert a number to this data type
        参数:
        n - The number
        返回:
        New data type number
      • getType

        public static DataType getType​(String name)
        Find the DataType that matches this name.
        参数:
        name - find DataType with this name.
        返回:
        DataType or null if no match.
      • getType

        public static DataType getType​(Class c)
        Find the DataType that matches this class.
        参数:
        c - primitive or object class, eg float.class or Float.class
        返回:
        DataType or null if no match.
      • getType

        public static DataType getType​(Class c,
                                       boolean isUnsigned)
        Find the DataType that matches this class.
        参数:
        c - primitive or object class, eg float.class or Float.class
        返回:
        DataType or null if no match.
      • unsignedLongToString

        public static String unsignedLongToString​(long li)
        convert an unsigned long to a String
        参数:
        li - unsigned int
        返回:
        equivalent long value
      • unsignedIntToLong

        public static long unsignedIntToLong​(int i)
        widen an unsigned int to a long
        参数:
        i - unsigned int
        返回:
        equivalent long value
      • unsignedShortToInt

        public static int unsignedShortToInt​(short s)
        widen an unsigned short to an int
        参数:
        s - unsigned short
        返回:
        equivalent int value
      • unsignedByteToShort

        public static short unsignedByteToShort​(byte b)
        widen an unsigned byte to a short
        参数:
        b - unsigned byte
        返回:
        equivalent short value
      • main

        public static void main​(String[] args)