枚举 DataType

  • 所有已实现的接口:
    java.io.Serializable, java.lang.Comparable<DataType>

    public enum DataType
    extends java.lang.Enum<DataType>
    Type-safe enumeration of data types.
    作者:
    john caron
    • 方法详细资料

      • values

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

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

        public java.lang.String toString()
        The DataType name, eg "byte", "float", "String".
        覆盖:
        toString 在类中 java.lang.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 java.lang.Class getClassType()
      • getPrimitiveClassType

        public java.lang.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.
      • 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
      • getType

        public static DataType getType​(java.lang.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​(java.lang.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.
      • unsignedLongToString

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

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

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

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

        public static void main​(java.lang.String[] args)