public class DbaseCodepage extends Object
Modifier and Type | Field and Description |
---|---|
static short[] |
dbfLdid
Define the valid dbf Language driver IDs (equivalent to MSDOS code pages), which are used on the byte 29
of the DBF header to define the DBF codepage.
|
static String[] |
ldidJava
Equivalent Java charset names to the code pages defined in
dbfLdid , using Java NIO Charset names
(which differ from JAVA IO names, see https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html) |
Constructor and Description |
---|
DbaseCodepage(File dbfFile)
Defines the dbfFile and constructs the name of the .cpg
file based on it
|
Modifier and Type | Method and Description |
---|---|
static String |
cpg2java(String codePage) |
String |
getCharset() |
static String |
getCharsetName(int ldid)
Gets the Java NIO charset name equivalent to the provided ldid
value.
|
static String |
getCpgFileName(String dbfFile) |
static int |
getLdid(String charsetName)
Gets the dbf Language driver IDs (code pages) corresponding
to the provided charset name
|
static String |
java2cpg(String charset) |
String |
read()
Reads the charset from the codepage file, and updates the internal
charset definition
|
void |
setCharset(String charset) |
void |
write(String charset)
Writes the specified charset to the codepage file, and updates
the internal charset definition
|
public static final short[] dbfLdid
ldidJava
array
(so 0x01 is equivalent to IBM437, 0x02 to IBM850, etc)
See some other equivalences in:
https://github.com/infused/dbf/blob/master/docs/supported_encodings.csv
https://github.com/olemb/dbfread/blob/master/dbfread/codepages.py
https://joinup.ec.europa.eu/svn/gvsig-desktop/trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/dbf/DbfEncodings.javapublic DbaseCodepage(File dbfFile)
dbfFile
- public String getCharset()
public void setCharset(String charset)
public String read()
public void write(String charset)
charset
- public static int getLdid(String charsetName)
public static String getCharsetName(int ldid)
ldid
-