Package oracle.spatial.util
Enum DBFFileCodePage
- java.lang.Object
-
- java.lang.Enum<DBFFileCodePage>
-
- oracle.spatial.util.DBFFileCodePage
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<DBFFileCodePage>
public enum DBFFileCodePage extends java.lang.Enum<DBFFileCodePage>
Enum that represents Code Pages supported by DBF files. This enum is a matrix that maps DBF single-byte code page mark into JVM's equivalentCharset
.This matrix was written by hand using several sources including:
- Wikipedia entries to find Code Page aliases - Java's supported Charsets list https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html - DBF specs
Each enum entry comprehends the next fields:- Code Page: A publicly-known Code Page e.g. 437, 850, 1252
- Platform name: Free text that helps identifying the code page platform (this is not based on any standard)
- Code Page Mark(s): A single-byte which value is found inside the DBF's header (at the 29th byte
of the DBF stream). This code page mark byte is completely arbitrary, and has no meaning
outside of DBF's world. Although DBF supports only one single-byte as the code page mark, there
are some code page marks that map back to the same
DBFFileCodePage
enum item; for example, 0X01 and 0X18 code page marks both point back to code page 437. - Charset alias(es): Optionally, each code page might have publicly-known charset aliases (some of them
backed by standards, other's by OS platform, others by Java, etc.). These aliases can be used to help
the JVM mapping back to the
Charset
impl. For example, "US-ASCII" is an alias for code page 20127, "Shift_JIS" is an alias for code page 932, "cp667" is an alias for code page 620
-
-
Enum Constant Summary
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DBFFileCodePage
fromCharsetName(java.lang.String charsetName)
static DBFFileCodePage
fromCodePage(int codePage)
static DBFFileCodePage
fromCodePageMark(byte codePageMark)
java.lang.String[]
getCharsetAliases()
Retrieves an array with each publicly-known alias for this platform that might be used by the JVM to map this into aCharset
instance by thetoCharset()
method.int
getCodePage()
Retrieves the publicly-known Code Page numeric value associated with this platformbyte[]
getCodePageMarks()
Retrieves an array representing each of the Code Page Mark bytes that might represent this platform.java.lang.String
getPlatform()
Retrieves the platform name.java.nio.charset.Charset
toCharset()
Maps this platform's Code Page to a JVM'sCharset
instance, making an exhaustive search using all known aliases.static DBFFileCodePage
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static DBFFileCodePage[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
CP28591_ISO_8859_1
public static final DBFFileCodePage CP28591_ISO_8859_1
-
CP20127_7_BIT_US_ASCII
public static final DBFFileCodePage CP20127_7_BIT_US_ASCII
-
CP65001_UTF_8
public static final DBFFileCodePage CP65001_UTF_8
-
CP437_OEM
public static final DBFFileCodePage CP437_OEM
-
CP850_OEM
public static final DBFFileCodePage CP850_OEM
-
CP1252_WINDOWS_ANSI
public static final DBFFileCodePage CP1252_WINDOWS_ANSI
-
MAC_ROMAN_STANDARD_MACINTOSH
public static final DBFFileCodePage MAC_ROMAN_STANDARD_MACINTOSH
-
CP865_OEM
public static final DBFFileCodePage CP865_OEM
-
CP932_JAPANESE_SHIFT_JIS
public static final DBFFileCodePage CP932_JAPANESE_SHIFT_JIS
-
CP863_OEM
public static final DBFFileCodePage CP863_OEM
-
CP852_OEM
public static final DBFFileCodePage CP852_OEM
-
CP860_PORTUGUESE_OEM
public static final DBFFileCodePage CP860_PORTUGUESE_OEM
-
CP866_RUSSIAN_OEM
public static final DBFFileCodePage CP866_RUSSIAN_OEM
-
CP936_CHINESE_SIMPLIFIED_WINDOWS
public static final DBFFileCodePage CP936_CHINESE_SIMPLIFIED_WINDOWS
-
CP950_TRADITIONAL_CHINESE_WINDOWS
public static final DBFFileCodePage CP950_TRADITIONAL_CHINESE_WINDOWS
-
CP874_THAI_ANSI_OEM
public static final DBFFileCodePage CP874_THAI_ANSI_OEM
-
CP861_ICELANDIC_MS_DOS
public static final DBFFileCodePage CP861_ICELANDIC_MS_DOS
-
KAMENICKY_CZECH_MS_DOS
public static final DBFFileCodePage KAMENICKY_CZECH_MS_DOS
-
MAZOVIA_POLISH_MS_DOS
public static final DBFFileCodePage MAZOVIA_POLISH_MS_DOS
-
CP737_GREEK_MS_DOS_437G
public static final DBFFileCodePage CP737_GREEK_MS_DOS_437G
-
CP857_TURKISH_OEM
public static final DBFFileCodePage CP857_TURKISH_OEM
-
CP949_KOREAN_WINDOWS
public static final DBFFileCodePage CP949_KOREAN_WINDOWS
-
CP1255_HEBREW_WINDOWS
public static final DBFFileCodePage CP1255_HEBREW_WINDOWS
-
CP1256_ARABIC_WINDOWS
public static final DBFFileCodePage CP1256_ARABIC_WINDOWS
-
MAC_CYRILLIC_RUSSIAN_MACINTOSH
public static final DBFFileCodePage MAC_CYRILLIC_RUSSIAN_MACINTOSH
-
MAC_LATIN2_MACINTOSH_EE
public static final DBFFileCodePage MAC_LATIN2_MACINTOSH_EE
-
MAC_GREEK_MACINTOSH
public static final DBFFileCodePage MAC_GREEK_MACINTOSH
-
CP1250_EASTERN_EUROPEAN_WINDOWS
public static final DBFFileCodePage CP1250_EASTERN_EUROPEAN_WINDOWS
-
CP1251_RUSSIAN_WINDOWS
public static final DBFFileCodePage CP1251_RUSSIAN_WINDOWS
-
CP1254_TURKISH_WINDOWS
public static final DBFFileCodePage CP1254_TURKISH_WINDOWS
-
CP1253_GREEK_WINDOWS
public static final DBFFileCodePage CP1253_GREEK_WINDOWS
-
CP1257_BALTIC_WINDOWS
public static final DBFFileCodePage CP1257_BALTIC_WINDOWS
-
-
Method Detail
-
values
public static DBFFileCodePage[] 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 (DBFFileCodePage c : DBFFileCodePage.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DBFFileCodePage valueOf(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
fromCodePageMark
public static DBFFileCodePage fromCodePageMark(byte codePageMark)
-
fromCharsetName
public static DBFFileCodePage fromCharsetName(java.lang.String charsetName)
-
fromCodePage
public static DBFFileCodePage fromCodePage(int codePage)
-
getCodePage
public int getCodePage()
Retrieves the publicly-known Code Page numeric value associated with this platform- Returns:
- the value assigned to this platform's Code Page.
-
getPlatform
public java.lang.String getPlatform()
Retrieves the platform name.- Returns:
- a text representing the platform name.
-
getCodePageMarks
public byte[] getCodePageMarks()
Retrieves an array representing each of the Code Page Mark bytes that might represent this platform. The retrieved array might be empty.- Returns:
- an array with each individual byte that maps to this platform.
-
getCharsetAliases
public java.lang.String[] getCharsetAliases()
Retrieves an array with each publicly-known alias for this platform that might be used by the JVM to map this into aCharset
instance by thetoCharset()
method.- Returns:
- all possible aliases that might be found by the JVM to load a Charset, including the computed alias for Code Page ("cpXXX" where XXX is a Code Page number)
-
toCharset
public java.nio.charset.Charset toCharset()
Maps this platform's Code Page to a JVM'sCharset
instance, making an exhaustive search using all known aliases.- Returns:
- a Charset instance, if the running JVM contains a
Charset
that can be mapped back. - Throws:
java.nio.charset.UnsupportedCharsetException
- if the JVM could not find any mapping for a Charset
-
-