public class CodePageUtil
extends java.lang.Object
Provides constants for understanding numeric codepages, along with utilities to translate these into Java Character Sets.
(用于使用 Microsoft CodePages 的实用程序。提供用于理解数字代码页的常量,以及将这些转换为 Java 字符集的实用程序。)Modifier and Type | Field and Description |
---|---|
static int |
CP_037
Codepage 037, a special case
(代码页 037,一种特殊情况)
|
static int |
CP_EUC_JP
Codepage for EUC-JP
(EUC-JP 的代码页)
|
static int |
CP_EUC_KR
Codepage for EUC-KR
(EUC-KR 的代码页)
|
static int |
CP_GB18030
Codepage for GB18030
(GB18030 代码页)
|
static int |
CP_GB2312
Codepage for GB2312
(GB2312 代码页)
|
static int |
CP_GBK
Codepage for GBK, aka MS936
(GBK 的代码页,又名 MS936)
|
static int |
CP_ISO_2022_JP1
Codepage for ISO-2022-JP
(ISO-2022-JP 的代码页)
|
static int |
CP_ISO_2022_JP2
Another codepage for ISO-2022-JP
(ISO-2022-JP 的另一个代码页)
|
static int |
CP_ISO_2022_JP3
Yet another codepage for ISO-2022-JP
(ISO-2022-JP 的另一个代码页)
|
static int |
CP_ISO_2022_KR
Codepage for ISO-2022-KR
(ISO-2022-KR 的代码页)
|
static int |
CP_ISO_8859_1
Codepage for ISO-8859-1
(ISO-8859-1 的代码页)
|
static int |
CP_ISO_8859_2
Codepage for ISO-8859-2
(ISO-8859-2 的代码页)
|
static int |
CP_ISO_8859_3
Codepage for ISO-8859-3
(ISO-8859-3 的代码页)
|
static int |
CP_ISO_8859_4
Codepage for ISO-8859-4
(ISO-8859-4 的代码页)
|
static int |
CP_ISO_8859_5
Codepage for ISO-8859-5
(ISO-8859-5 的代码页)
|
static int |
CP_ISO_8859_6
Codepage for ISO-8859-6
(ISO-8859-6 的代码页)
|
static int |
CP_ISO_8859_7
Codepage for ISO-8859-7
(ISO-8859-7 的代码页)
|
static int |
CP_ISO_8859_8
Codepage for ISO-8859-8
(ISO-8859-8 的代码页)
|
static int |
CP_ISO_8859_9
Codepage for ISO-8859-9
(ISO-8859-9 的代码页)
|
static int |
CP_JOHAB
Codepage for Johab
(Johab 的代码页)
|
static int |
CP_KOI8_R
Codepage for KOI8-R
(KOI8-R 的代码页)
|
static int |
CP_MAC_ARABIC
Codepage for Macintosh Arabic (Java: MacArabic)
(Macintosh 阿拉伯语代码页 (Java: MacArabic))
|
static int |
CP_MAC_CENTRAL_EUROPE
Codepage for Macintosh Central Europe (Latin-2) (Java: MacCentralEurope)
(Macintosh Central Europe (Latin-2) 的代码页 (Java: MacCentralEurope))
|
static int |
CP_MAC_CHINESE_SIMPLE
Codepage for Macintosh Chinese Simplified (Java: unknown - use EUC_CN, ISO2022_CN_GB, MS936 or cp935)
(Macintosh 简体中文的代码页(Java:未知 - 使用 EUC_CN、ISO2022_CN_GB、MS936 或 cp935))
|
static int |
CP_MAC_CHINESE_TRADITIONAL
Codepage for Macintosh Chinese Traditional (Java: unknown - use Big5, MS950, or cp937)
(Macintosh 繁体中文的代码页(Java:未知 - 使用 Big5、MS950 或 cp937))
|
static int |
CP_MAC_CROATIAN
Codepage for Macintosh Croatian (Java: MacCroatian)
(Macintosh 克罗地亚语 (Java: MacCroatian) 的代码页)
|
static int |
CP_MAC_CYRILLIC
Codepage for Macintosh Cyrillic (Java: MacCyrillic)
(Macintosh Cyrillic 的代码页(Java:MacCyrillic))
|
static int |
CP_MAC_GREEK
Codepage for Macintosh Greek (Java: MacGreek)
(Macintosh 希腊语代码页 (Java: MacGreek))
|
static int |
CP_MAC_HEBREW
Codepage for Macintosh Hebrew (Java: MacHebrew)
(Macintosh 希伯来语的代码页(Java:MacHebrew))
|
static int |
CP_MAC_ICELAND
Codepage for Macintosh Iceland (Java: MacIceland)
(Macintosh Iceland 的代码页(Java:MacIceland))
|
static int |
CP_MAC_JAPAN
Codepage for Macintosh Japan (Java: unknown - use SJIS, cp942 or cp943)
(Macintosh Japan 的代码页(Java:未知 - 使用 SJIS、cp942 或 cp943))
|
static int |
CP_MAC_KOREAN
Codepage for Macintosh Korean (Java: unknown - use EUC_KR or cp949)
(Macintosh 韩语的代码页(Java:未知 - 使用 EUC_KR 或 cp949))
|
static int |
CP_MAC_ROMAN
Codepage for Macintosh Roman (Java: MacRoman)
(Macintosh Roman 的代码页 (Java: MacRoman))
|
static int |
CP_MAC_ROMAN_BIFF23 |
static int |
CP_MAC_ROMANIA
Codepage for Macintosh Romanian (Java: MacRomania)
(Macintosh 罗马尼亚语代码页 (Java: MacRomania))
|
static int |
CP_MAC_THAI
Codepage for Macintosh Thai (Java: MacThai)
(Macintosh Thai 的代码页 (Java: MacThai))
|
static int |
CP_MAC_TURKISH
Codepage for Macintosh Turkish (Java: MacTurkish)
(Macintosh 土耳其语代码页 (Java: MacTurkish))
|
static int |
CP_MAC_UKRAINE
Codepage for Macintosh Ukrainian (Java: MacUkraine)
(Macintosh 乌克兰语 (Java: MacUkraine) 的代码页)
|
static int |
CP_MS949
Codepage for MS949
(MS949 的代码页)
|
static int |
CP_SJIS
Codepage for SJIS
(SJIS 的代码页)
|
static int |
CP_UNICODE
Codepage for Unicode
(Unicode 代码页)
|
static int |
CP_US_ACSII
Codepage for US-ASCII
(US-ASCII 的代码页)
|
static int |
CP_US_ASCII2
Another codepage for US-ASCII
(US-ASCII 的另一个代码页)
|
static int |
CP_UTF16
Codepage for UTF-16
(UTF-16 的代码页)
|
static int |
CP_UTF16_BE
Codepage for UTF-16 big-endian
(UTF-16 big-endian 的代码页)
|
static int |
CP_UTF8
Codepage for UTF-8
(UTF-8 的代码页)
|
static int |
CP_WINDOWS_1250
Codepage for Windows 1250
(Windows 1250 的代码页)
|
static int |
CP_WINDOWS_1251
Codepage for Windows 1251
(Windows 1251 的代码页)
|
static int |
CP_WINDOWS_1252
Codepage for Windows 1252
(Windows 1252 的代码页)
|
static int |
CP_WINDOWS_1252_BIFF23 |
static int |
CP_WINDOWS_1253
Codepage for Windows 1253
(Windows 1253 的代码页)
|
static int |
CP_WINDOWS_1254
Codepage for Windows 1254
(Windows 1254 的代码页)
|
static int |
CP_WINDOWS_1255
Codepage for Windows 1255
(Windows 1255 的代码页)
|
static int |
CP_WINDOWS_1256
Codepage for Windows 1256
(Windows 1256 的代码页)
|
static int |
CP_WINDOWS_1257
Codepage for Windows 1257
(Windows 1257 的代码页)
|
static int |
CP_WINDOWS_1258
Codepage for Windows 1258
(Windows 1258 的代码页)
|
Constructor and Description |
---|
CodePageUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
codepageToEncoding(int codepage)
Turns a codepage number into the equivalent character encoding's name (in Java NIO canonical naming format).
(将代码页编号转换为等效字符编码的名称(Java NIO 规范命名格式)。)
|
static java.lang.String |
codepageToEncoding(int codepage, boolean javaLangFormat)
Turns a codepage number into the equivalent character encoding's name, in either Java NIO or Java Lang canonical naming.
(将代码页编号转换为等效的字符编码名称,采用 Java NIO 或 Java Lang 规范命名。)
|
static byte[] |
getBytesInCodePage(java.lang.String string, int codepage)
Converts a string into bytes, in the equivalent character encoding to the supplied codepage number.
(将字符串转换为字节,采用与提供的代码页号等效的字符编码。)
|
static java.lang.String |
getStringFromCodePage(byte[] string, int codepage)
Converts the bytes into a String, based on the equivalent character encoding to the supplied codepage number.
(根据提供的代码页编号的等效字符编码,将字节转换为字符串。)
|
static java.lang.String |
getStringFromCodePage(byte[] string, int offset, int length, int codepage)
Converts the bytes into a String, based on the equivalent character encoding to the supplied codepage number.
(根据提供的代码页编号的等效字符编码,将字节转换为字符串。)
|
public static final int CP_037
Codepage 037, a special case
(代码页 037,一种特殊情况)public static final int CP_SJIS
Codepage for SJIS
(SJIS 的代码页)public static final int CP_GBK
Codepage for GBK, aka MS936
(GBK 的代码页,又名 MS936)public static final int CP_MS949
Codepage for MS949
(MS949 的代码页)public static final int CP_UTF16
Codepage for UTF-16
(UTF-16 的代码页)public static final int CP_UTF16_BE
Codepage for UTF-16 big-endian
(UTF-16 big-endian 的代码页)public static final int CP_WINDOWS_1250
Codepage for Windows 1250
(Windows 1250 的代码页)public static final int CP_WINDOWS_1251
Codepage for Windows 1251
(Windows 1251 的代码页)public static final int CP_WINDOWS_1252
Codepage for Windows 1252
(Windows 1252 的代码页)public static final int CP_WINDOWS_1252_BIFF23
public static final int CP_WINDOWS_1253
Codepage for Windows 1253
(Windows 1253 的代码页)public static final int CP_WINDOWS_1254
Codepage for Windows 1254
(Windows 1254 的代码页)public static final int CP_WINDOWS_1255
Codepage for Windows 1255
(Windows 1255 的代码页)public static final int CP_WINDOWS_1256
Codepage for Windows 1256
(Windows 1256 的代码页)public static final int CP_WINDOWS_1257
Codepage for Windows 1257
(Windows 1257 的代码页)public static final int CP_WINDOWS_1258
Codepage for Windows 1258
(Windows 1258 的代码页)public static final int CP_JOHAB
Codepage for Johab
(Johab 的代码页)public static final int CP_MAC_ROMAN
Codepage for Macintosh Roman (Java: MacRoman)
(Macintosh Roman 的代码页 (Java: MacRoman))public static final int CP_MAC_ROMAN_BIFF23
public static final int CP_MAC_JAPAN
Codepage for Macintosh Japan (Java: unknown - use SJIS, cp942 or cp943)
(Macintosh Japan 的代码页(Java:未知 - 使用 SJIS、cp942 或 cp943))public static final int CP_MAC_CHINESE_TRADITIONAL
Codepage for Macintosh Chinese Traditional (Java: unknown - use Big5, MS950, or cp937)
(Macintosh 繁体中文的代码页(Java:未知 - 使用 Big5、MS950 或 cp937))public static final int CP_MAC_KOREAN
Codepage for Macintosh Korean (Java: unknown - use EUC_KR or cp949)
(Macintosh 韩语的代码页(Java:未知 - 使用 EUC_KR 或 cp949))public static final int CP_MAC_ARABIC
Codepage for Macintosh Arabic (Java: MacArabic)
(Macintosh 阿拉伯语代码页 (Java: MacArabic))public static final int CP_MAC_HEBREW
Codepage for Macintosh Hebrew (Java: MacHebrew)
(Macintosh 希伯来语的代码页(Java:MacHebrew))public static final int CP_MAC_GREEK
Codepage for Macintosh Greek (Java: MacGreek)
(Macintosh 希腊语代码页 (Java: MacGreek))public static final int CP_MAC_CYRILLIC
Codepage for Macintosh Cyrillic (Java: MacCyrillic)
(Macintosh Cyrillic 的代码页(Java:MacCyrillic))public static final int CP_MAC_CHINESE_SIMPLE
Codepage for Macintosh Chinese Simplified (Java: unknown - use EUC_CN, ISO2022_CN_GB, MS936 or cp935)
(Macintosh 简体中文的代码页(Java:未知 - 使用 EUC_CN、ISO2022_CN_GB、MS936 或 cp935))public static final int CP_MAC_ROMANIA
Codepage for Macintosh Romanian (Java: MacRomania)
(Macintosh 罗马尼亚语代码页 (Java: MacRomania))public static final int CP_MAC_UKRAINE
Codepage for Macintosh Ukrainian (Java: MacUkraine)
(Macintosh 乌克兰语 (Java: MacUkraine) 的代码页)public static final int CP_MAC_THAI
Codepage for Macintosh Thai (Java: MacThai)
(Macintosh Thai 的代码页 (Java: MacThai))public static final int CP_MAC_CENTRAL_EUROPE
Codepage for Macintosh Central Europe (Latin-2) (Java: MacCentralEurope)
(Macintosh Central Europe (Latin-2) 的代码页 (Java: MacCentralEurope))public static final int CP_MAC_ICELAND
Codepage for Macintosh Iceland (Java: MacIceland)
(Macintosh Iceland 的代码页(Java:MacIceland))public static final int CP_MAC_TURKISH
Codepage for Macintosh Turkish (Java: MacTurkish)
(Macintosh 土耳其语代码页 (Java: MacTurkish))public static final int CP_MAC_CROATIAN
Codepage for Macintosh Croatian (Java: MacCroatian)
(Macintosh 克罗地亚语 (Java: MacCroatian) 的代码页)public static final int CP_US_ACSII
Codepage for US-ASCII
(US-ASCII 的代码页)public static final int CP_KOI8_R
Codepage for KOI8-R
(KOI8-R 的代码页)public static final int CP_ISO_8859_1
Codepage for ISO-8859-1
(ISO-8859-1 的代码页)public static final int CP_ISO_8859_2
Codepage for ISO-8859-2
(ISO-8859-2 的代码页)public static final int CP_ISO_8859_3
Codepage for ISO-8859-3
(ISO-8859-3 的代码页)public static final int CP_ISO_8859_4
Codepage for ISO-8859-4
(ISO-8859-4 的代码页)public static final int CP_ISO_8859_5
Codepage for ISO-8859-5
(ISO-8859-5 的代码页)public static final int CP_ISO_8859_6
Codepage for ISO-8859-6
(ISO-8859-6 的代码页)public static final int CP_ISO_8859_7
Codepage for ISO-8859-7
(ISO-8859-7 的代码页)public static final int CP_ISO_8859_8
Codepage for ISO-8859-8
(ISO-8859-8 的代码页)public static final int CP_ISO_8859_9
Codepage for ISO-8859-9
(ISO-8859-9 的代码页)public static final int CP_ISO_2022_JP1
Codepage for ISO-2022-JP
(ISO-2022-JP 的代码页)public static final int CP_ISO_2022_JP2
Another codepage for ISO-2022-JP
(ISO-2022-JP 的另一个代码页)public static final int CP_ISO_2022_JP3
Yet another codepage for ISO-2022-JP
(ISO-2022-JP 的另一个代码页)public static final int CP_ISO_2022_KR
Codepage for ISO-2022-KR
(ISO-2022-KR 的代码页)public static final int CP_EUC_JP
Codepage for EUC-JP
(EUC-JP 的代码页)public static final int CP_EUC_KR
Codepage for EUC-KR
(EUC-KR 的代码页)public static final int CP_GB2312
Codepage for GB2312
(GB2312 代码页)public static final int CP_GB18030
Codepage for GB18030
(GB18030 代码页)public static final int CP_US_ASCII2
Another codepage for US-ASCII
(US-ASCII 的另一个代码页)public static final int CP_UTF8
Codepage for UTF-8
(UTF-8 的代码页)public static final int CP_UNICODE
Codepage for Unicode
(Unicode 代码页)public static byte[] getBytesInCodePage(java.lang.String string, int codepage) throws java.io.UnsupportedEncodingException
string
- The string to convert
(string - 要转换的字符串)
codepage
- The codepage number
(codepage - 代码页编号)
java.io.UnsupportedEncodingException
(java.io.UnsupportedEncodingException)
public static java.lang.String getStringFromCodePage(byte[] string, int codepage) throws java.io.UnsupportedEncodingException
string
- The byte of the string to convert
(string - 要转换的字符串的字节)
codepage
- The codepage number
(codepage - 代码页编号)
java.io.UnsupportedEncodingException
(java.io.UnsupportedEncodingException)
public static java.lang.String getStringFromCodePage(byte[] string, int offset, int length, int codepage) throws java.io.UnsupportedEncodingException
string
- The byte of the string to convert
(string - 要转换的字符串的字节)
codepage
- The codepage number
(codepage - 代码页编号)
java.io.UnsupportedEncodingException
(java.io.UnsupportedEncodingException)
public static java.lang.String codepageToEncoding(int codepage) throws java.io.UnsupportedEncodingException
Turns a codepage number into the equivalent character encoding's name (in Java NIO canonical naming format).
(将代码页编号转换为等效字符编码的名称(Java NIO 规范命名格式)。)codepage
- The codepage number
(codepage - 代码页编号)
java.io.UnsupportedEncodingException
- if the specified codepage is less than zero.
(java.io.UnsupportedEncodingException - 如果指定的代码页小于零。)
public static java.lang.String codepageToEncoding(int codepage, boolean javaLangFormat) throws java.io.UnsupportedEncodingException
Turns a codepage number into the equivalent character encoding's name, in either Java NIO or Java Lang canonical naming.
(将代码页编号转换为等效的字符编码名称,采用 Java NIO 或 Java Lang 规范命名。)codepage
- The codepage number
(codepage - 代码页编号)
javaLangFormat
- Should Java Lang or Java NIO naming be used?
(javaLangFormat - 应该使用 Java Lang 还是 Java NIO 命名?)
java.io.UnsupportedEncodingException
- if the specified codepage is less than zero.
(java.io.UnsupportedEncodingException - 如果指定的代码页小于零。)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.