Enum DBaseFieldType

  • All Implemented Interfaces:
    Serializable, Comparable<DBaseFieldType>

    public enum DBaseFieldType
    extends Enum<DBaseFieldType>
    Describes the supported types in DBase fields.
     -----------------------------------------------------------
                            Field Type (1 byte)
     -----------------------------------------------------------
      Char. Size    Type     Content
     -----------------------------------------------------------
      C     1..n    STRING   ASCII fill with spaces (not final
                             \0 character).
                             n=64kb (using deci. counter)
                             n=32kb (using deci. counter)
                             n=254
      D        8    DATE     [0-9]{8} with in format YYYYMMDD
      F     1..n    NUMERIC  [-.0-9]+, variable position
                             of floating position
      N     1..n    NUMERIC  [-.0-9]+, fixed position,
                             no floating position
      L        1    LOGICAL  [TtFfYyNn ?]
      M       10    MEMORY   10 digits representing the start
                             block position in the .dbt file,
                             or 10 spaces if no entry in memo
      V       10    VARIABLE data in .dbv file,
                             4 bytes: start pos in memory
                             4 bytes: block size
                             1 byte:  subtype
                             1 byte:  reserved (0x1A)
                             10 spaces if no entry in .dbv
      P       10    PICTURE  binary data in .ftp file (same
                             structure as M type)
      B       10    BINARY   binary data in .dbt file (same
                             structure as M type)
      G       10    GENERAL  OLE objects (same
                             structure as M type)
      2        2    NUMERIC  short integer +/- 32762
      4        4    NUMERIC  long integer +/- 2147483647
      8        8    NUMERIC  signed double IEEE
     -----------------------------------------------------------
     
    Since:
    14.0
    Version:
    17.0 2020-01-04 14:41:52
    Author:
    Stéphane GALLAND, Olivier LAMOTTE
    Maven Group Id:
    org.arakhne.afc.advanced
    Maven Artifact Id:
    dbasefile
    • Method Detail

      • values

        public static DBaseFieldType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (DBaseFieldType c : DBaseFieldType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static DBaseFieldType valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • fromByte

        @Pure
        public static DBaseFieldType fromByte​(byte abyte)
                                       throws DBaseFileException
        Replies the field type that corresponds to the specified byte.
        Parameters:
        abyte - is a byte that describes the dBase field type.
        Returns:
        the corresponding type.
        Throws:
        DBaseFileException - if the given byte is unknown.
      • toByte

        @Pure
        public byte toByte()
        Replies the byte representation of this type.
        Returns:
        the byte used by dBase to represent this type of field.
      • toAttributeType

        @Pure
        public AttributeType toAttributeType()
        Replies the attribute type corresponding to the field type.
        Returns:
        the associated attribute type.
      • fromAttributeType

        @Pure
        public static DBaseFieldType fromAttributeType​(AttributeType type)
                                                throws DBaseFileException
        Replies the field type corresponding to the attribute type.
        Parameters:
        type - is the attribute type to convert
        Returns:
        the dBase field type that corresponds to the given attribute type.
        Throws:
        DBaseFileException - if the given type is unknown.
      • getFieldSize

        @Pure
        public int getFieldSize()
        Replies the size in bytes of a field that corresponds to this type.
        Returns:
        the size in bytes of a field that corresponds to this type.
      • getFieldSize

        @Pure
        public int getFieldSize​(String value)
        Replies the size in bytes of a field that corresponds to this type.
        Parameters:
        value - the value.
        Returns:
        the size in bytes of a field that corresponds to this type.
      • getDecimalPointPosition

        @Pure
        public int getDecimalPointPosition()
        Replies the position of the decimal point of a field that corresponds to this type.
        Returns:
        the position of the decimal point.
      • getDecimalPointPosition

        @Pure
        public int getDecimalPointPosition​(String value)
        Replies the position of the decimal point of a field that corresponds to this type.
        Parameters:
        value - the value.
        Returns:
        the position of the decimal point