Enum DBFEncoding

java.lang.Object
java.lang.Enum<DBFEncoding>
io.github.zazalng.contracts.DBFEncoding
All Implemented Interfaces:
Serializable, Comparable<DBFEncoding>, java.lang.constant.Constable

public enum DBFEncoding extends Enum<DBFEncoding>
Represents DBF Language Driver ID (LDID) encodings, which define the character set used for text fields within the file.

This enum maps the single-byte code found in the DBF header (byte 29) to a Java-compatible Charset name. The references are based on standard xBase, dBASE, and Visual FoxPro documentation.

Since:
1.0.0
Author:
Zazalng
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    LDID: 0xC8 - Eastern European Windows (windows-1250).
    LDID: 0xC9 - Russian Windows (windows-1251).
    LDID: 0x03 - Windows ANSI (windows-1252).
    LDID: 0x57 - ANSI (windows-1252).
    LDID: 0x58 - Western European ANSI (windows-1252).
    LDID: 0x59 - Spanish ANSI (windows-1252).
    LDID: 0xCB - Greek Windows (windows-1253).
    LDID: 0xCA - Turkish Windows (windows-1254).
    LDID: 0xCC - Baltic Windows (windows-1257).
    LDID: 0x01 - U.S.
    LDID: 0x09 - Dutch OEM (CP437).
    LDID: 0x0B - Finnish OEM (CP437).
    LDID: 0x0D - French OEM (CP437).
    LDID: 0x0F - German OEM (CP437).
    LDID: 0x11 - Italian OEM (CP437).
    LDID: 0x15 - Swedish OEM (CP437).
    LDID: 0x18 - Spanish OEM (CP437).
    LDID: 0x19 - English OEM (Britain) (CP437).
    LDID: 0x1B - English OEM (U.S.)
    LDID: 0x6A - Greek MS-DOS (437G) (CP737).
    LDID: 0x86 - Greek OEM (CP737).
    LDID: 0x02 - International MS-DOS (CP850).
    LDID: 0x0A - Dutch OEM* (CP850).
    LDID: 0x0E - French OEM* (CP850).
    LDID: 0x10 - German OEM* (CP850).
    LDID: 0x12 - Italian OEM* (CP850).
    LDID: 0x14 - Spanish OEM* (CP850).
    LDID: 0x16 - Swedish OEM* (CP850).
    LDID: 0x1A - English OEM (Britain)* (CP850).
    LDID: 0x1D - French OEM* (CP850).
    LDID: 0x25 - Portuguese OEM* (CP850).
    LDID: 0x37 - English OEM (U.S.)* (CP850).
    LDID: 0x1F - Czech OEM (CP852).
    LDID: 0x22 - Hungarian OEM (CP852).
    LDID: 0x23 - Polish OEM (CP852).
    LDID: 0x40 - Romanian OEM (CP852).
    LDID: 0x64 - Eastern European MS-DOS (CP852).
    LDID: 0x87 - Slovenian OEM (CP852).
    LDID: 0x6B - Turkish MS-DOS (CP857).
    LDID: 0x88 - Turkish OEM (CP857).
    LDID: 0x24 - Portuguese OEM (CP860).
    LDID: 0x67 - Icelandic MS-DOS (CP861).
    LDID: 0x1C - French OEM (Canada) (CP863).
    LDID: 0x6C - French-Canadian MS-DOS (CP863).
    LDID: 0x08 - Danish OEM (CP865).
    LDID: 0x17 - Norwegian OEM (CP865).
    LDID: 0x66 - Nordic MS-DOS (CP865).
    LDID: 0x26 - Russian OEM (CP866).
    LDID: 0x65 - Russian MS-DOS (CP866).
    LDID: 0x50 - Thai (ANSI/OEM) (x-windows-874).
    LDID: 0x7C - Thai Windows/MS-DOS (x-windows-874).
    LDID: 0x13 - Japanese Shift-JIS (MS932).
    LDID: 0x7B - Japanese Shift-JIS (MS932).
    LDID: 0x4D - Chinese GBK (PRC) (GBK).
    LDID: 0x7A - PRC GBK (GBK).
    LDID: 0x4E - Korean (ANSI/OEM) (x-windows-949).
    LDID: 0x79 - Hangul (Wansung) (x-windows-949).
    LDID: 0x4F - Chinese Big5 (Taiwan) (x-windows-950).
    LDID: 0x78 - Taiwan Big5 (x-windows-950).
    LDID: 0x00 - Default fallback, typically assumed to be Windows ANSI (windows-1252) when not specified.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromCode(int code)
    Retrieves the DBFEncoding enum constant corresponding to the given LDID code.
    Gets the Java-compatible character set name.
    int
    Gets the Language Driver ID (LDID) code.
    Gets a human-readable description of the encoding.
    Converts the encoding name into a Charset object for I/O operations.
    Provides a descriptive string representation of the encoding.
    Returns the enum constant of this type with the specified name.
    static DBFEncoding[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • CP437_01

      public static final DBFEncoding CP437_01
      LDID: 0x01 - U.S. MS-DOS (CP437).
    • CP850_02

      public static final DBFEncoding CP850_02
      LDID: 0x02 - International MS-DOS (CP850).
    • CP1252_03

      public static final DBFEncoding CP1252_03
      LDID: 0x03 - Windows ANSI (windows-1252).
    • CP865_08

      public static final DBFEncoding CP865_08
      LDID: 0x08 - Danish OEM (CP865).
    • CP437_09

      public static final DBFEncoding CP437_09
      LDID: 0x09 - Dutch OEM (CP437).
    • CP850_0A

      public static final DBFEncoding CP850_0A
      LDID: 0x0A - Dutch OEM* (CP850).
    • CP437_0B

      public static final DBFEncoding CP437_0B
      LDID: 0x0B - Finnish OEM (CP437).
    • CP437_0D

      public static final DBFEncoding CP437_0D
      LDID: 0x0D - French OEM (CP437).
    • CP850_0E

      public static final DBFEncoding CP850_0E
      LDID: 0x0E - French OEM* (CP850).
    • CP437_0F

      public static final DBFEncoding CP437_0F
      LDID: 0x0F - German OEM (CP437).
    • CP850_10

      public static final DBFEncoding CP850_10
      LDID: 0x10 - German OEM* (CP850).
    • CP437_11

      public static final DBFEncoding CP437_11
      LDID: 0x11 - Italian OEM (CP437).
    • CP850_12

      public static final DBFEncoding CP850_12
      LDID: 0x12 - Italian OEM* (CP850).
    • CP932_13

      public static final DBFEncoding CP932_13
      LDID: 0x13 - Japanese Shift-JIS (MS932).
    • CP850_14

      public static final DBFEncoding CP850_14
      LDID: 0x14 - Spanish OEM* (CP850).
    • CP437_15

      public static final DBFEncoding CP437_15
      LDID: 0x15 - Swedish OEM (CP437).
    • CP850_16

      public static final DBFEncoding CP850_16
      LDID: 0x16 - Swedish OEM* (CP850).
    • CP865_17

      public static final DBFEncoding CP865_17
      LDID: 0x17 - Norwegian OEM (CP865).
    • CP437_18

      public static final DBFEncoding CP437_18
      LDID: 0x18 - Spanish OEM (CP437).
    • CP437_19

      public static final DBFEncoding CP437_19
      LDID: 0x19 - English OEM (Britain) (CP437).
    • CP850_1A

      public static final DBFEncoding CP850_1A
      LDID: 0x1A - English OEM (Britain)* (CP850).
    • CP437_1B

      public static final DBFEncoding CP437_1B
      LDID: 0x1B - English OEM (U.S.) (CP437).
    • CP863_1C

      public static final DBFEncoding CP863_1C
      LDID: 0x1C - French OEM (Canada) (CP863).
    • CP850_1D

      public static final DBFEncoding CP850_1D
      LDID: 0x1D - French OEM* (CP850).
    • CP852_1F

      public static final DBFEncoding CP852_1F
      LDID: 0x1F - Czech OEM (CP852).
    • CP852_22

      public static final DBFEncoding CP852_22
      LDID: 0x22 - Hungarian OEM (CP852).
    • CP852_23

      public static final DBFEncoding CP852_23
      LDID: 0x23 - Polish OEM (CP852).
    • CP860_24

      public static final DBFEncoding CP860_24
      LDID: 0x24 - Portuguese OEM (CP860).
    • CP850_25

      public static final DBFEncoding CP850_25
      LDID: 0x25 - Portuguese OEM* (CP850).
    • CP866_26

      public static final DBFEncoding CP866_26
      LDID: 0x26 - Russian OEM (CP866).
    • CP850_37

      public static final DBFEncoding CP850_37
      LDID: 0x37 - English OEM (U.S.)* (CP850).
    • CP852_40

      public static final DBFEncoding CP852_40
      LDID: 0x40 - Romanian OEM (CP852).
    • CP936_4D

      public static final DBFEncoding CP936_4D
      LDID: 0x4D - Chinese GBK (PRC) (GBK).
    • CP949_4E

      public static final DBFEncoding CP949_4E
      LDID: 0x4E - Korean (ANSI/OEM) (x-windows-949).
    • CP950_4F

      public static final DBFEncoding CP950_4F
      LDID: 0x4F - Chinese Big5 (Taiwan) (x-windows-950).
    • CP874_50

      public static final DBFEncoding CP874_50
      LDID: 0x50 - Thai (ANSI/OEM) (x-windows-874).
    • CP1252_57

      public static final DBFEncoding CP1252_57
      LDID: 0x57 - ANSI (windows-1252).
    • CP1252_58

      public static final DBFEncoding CP1252_58
      LDID: 0x58 - Western European ANSI (windows-1252).
    • CP1252_59

      public static final DBFEncoding CP1252_59
      LDID: 0x59 - Spanish ANSI (windows-1252).
    • CP852_64

      public static final DBFEncoding CP852_64
      LDID: 0x64 - Eastern European MS-DOS (CP852).
    • CP866_65

      public static final DBFEncoding CP866_65
      LDID: 0x65 - Russian MS-DOS (CP866).
    • CP865_66

      public static final DBFEncoding CP865_66
      LDID: 0x66 - Nordic MS-DOS (CP865).
    • CP861_67

      public static final DBFEncoding CP861_67
      LDID: 0x67 - Icelandic MS-DOS (CP861).
    • CP737_6A

      public static final DBFEncoding CP737_6A
      LDID: 0x6A - Greek MS-DOS (437G) (CP737).
    • CP857_6B

      public static final DBFEncoding CP857_6B
      LDID: 0x6B - Turkish MS-DOS (CP857).
    • CP863_6C

      public static final DBFEncoding CP863_6C
      LDID: 0x6C - French-Canadian MS-DOS (CP863).
    • CP950_78

      public static final DBFEncoding CP950_78
      LDID: 0x78 - Taiwan Big5 (x-windows-950).
    • CP949_79

      public static final DBFEncoding CP949_79
      LDID: 0x79 - Hangul (Wansung) (x-windows-949).
    • CP936_7A

      public static final DBFEncoding CP936_7A
      LDID: 0x7A - PRC GBK (GBK).
    • CP932_7B

      public static final DBFEncoding CP932_7B
      LDID: 0x7B - Japanese Shift-JIS (MS932).
    • CP874_7C

      public static final DBFEncoding CP874_7C
      LDID: 0x7C - Thai Windows/MS-DOS (x-windows-874).
    • CP737_86

      public static final DBFEncoding CP737_86
      LDID: 0x86 - Greek OEM (CP737).
    • CP852_87

      public static final DBFEncoding CP852_87
      LDID: 0x87 - Slovenian OEM (CP852).
    • CP857_88

      public static final DBFEncoding CP857_88
      LDID: 0x88 - Turkish OEM (CP857).
    • CP1250_C8

      public static final DBFEncoding CP1250_C8
      LDID: 0xC8 - Eastern European Windows (windows-1250).
    • CP1251_C9

      public static final DBFEncoding CP1251_C9
      LDID: 0xC9 - Russian Windows (windows-1251).
    • CP1254_CA

      public static final DBFEncoding CP1254_CA
      LDID: 0xCA - Turkish Windows (windows-1254).
    • CP1253_CB

      public static final DBFEncoding CP1253_CB
      LDID: 0xCB - Greek Windows (windows-1253).
    • CP1257_CC

      public static final DBFEncoding CP1257_CC
      LDID: 0xCC - Baltic Windows (windows-1257).
    • UNKNOWN

      public static final DBFEncoding UNKNOWN
      LDID: 0x00 - Default fallback, typically assumed to be Windows ANSI (windows-1252) when not specified.
  • Method Details

    • values

      public static DBFEncoding[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static DBFEncoding 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
    • getCode

      public int getCode()
      Gets the Language Driver ID (LDID) code.
      Returns:
      The integer code (0x00 to 0xFF).
    • getCharsetName

      public String getCharsetName()
      Gets the Java-compatible character set name.
      Returns:
      The string name of the character set (e.g., "CP437", "windows-1252").
    • getDescription

      public String getDescription()
      Gets a human-readable description of the encoding.
      Returns:
      The description of the language/platform encoding.
    • toCharset

      public Charset toCharset()
      Converts the encoding name into a Charset object for I/O operations.
      Returns:
      A Charset instance.
    • fromCode

      public static DBFEncoding fromCode(int code)
      Retrieves the DBFEncoding enum constant corresponding to the given LDID code. Defaults to UNKNOWN if the code is not found.
      Parameters:
      code - The integer LDID code to look up.
      Returns:
      The matching DBFEncoding constant.
    • toString

      public String toString()
      Provides a descriptive string representation of the encoding.
      Overrides:
      toString in class Enum<DBFEncoding>
      Returns:
      The enum name, hex code, and charset name.