本文整理汇总了Java中org.mozilla.universalchardet.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于org.mozilla.universalchardet包,在下文中一共展示了Constants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: report
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
@Override
public void report(String name) {
if (Constants.CHARSET_WINDOWS_1252.equals(name)) {
if (hint != null) {
// Use the encoding hint when available
name = hint;
} else if (statistics.count('\r') == 0) {
// If there are no CR(LF)s, then the encoding is more
// likely to be ISO-8859-1(5) than windows-1252
if (statistics.count(0xa4) > 0) { // currency/euro sign
// The general currency sign is hardly ever used in
// ISO-8859-1, so it's more likely that we're dealing
// with ISO-8859-15, where the character is used for
// the euro symbol, which is more commonly used.
name = CHARSET_ISO_8859_15;
} else {
name = CHARSET_ISO_8859_1;
}
}
}
try {
this.charset = CharsetUtils.forName(name);
} catch (Exception e) {
// ignore
}
}
示例2: getCharsetFromBOM
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
/**
* Get the charset from BOM if available.
*
* @param bom BOM of the file
* @return Charset
*/
public static String getCharsetFromBOM(UnicodeBOMInputStream.BOM bom) {
if (UnicodeBOMInputStream.BOM.UTF_32_BE.equals(bom)) {
return Constants.CHARSET_UTF_32BE;
} else if (UnicodeBOMInputStream.BOM.UTF_32_LE.equals(bom)) {
return Constants.CHARSET_UTF_32LE;
} else if (UnicodeBOMInputStream.BOM.UTF_8.equals(bom)) {
return Constants.CHARSET_UTF_8;
} else if (UnicodeBOMInputStream.BOM.UTF_16_BE.equals(bom)) {
return Constants.CHARSET_UTF_16BE;
} else if (UnicodeBOMInputStream.BOM.UTF_16_LE.equals(bom)) {
return Constants.CHARSET_UTF_16LE;
}
return "UTF-8";
}
示例3: report
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public void report(String name) {
if (Constants.CHARSET_WINDOWS_1252.equals(name)) {
if (hint != null) {
// Use the encoding hint when available
name = hint;
} else if (statistics.count('\r') == 0) {
// If there are no CR(LF)s, then the encoding is more
// likely to be ISO-8859-1(5) than windows-1252
if (statistics.count(0xa4) > 0) { // currency/euro sign
// The general currency sign is hardly ever used in
// ISO-8859-1, so it's more likely that we're dealing
// with ISO-8859-15, where the character is used for
// the euro symbol, which is more commonly used.
name = CHARSET_ISO_8859_15;
} else {
name = CHARSET_ISO_8859_1;
}
}
}
try {
this.charset = CharsetUtils.forName(name);
} catch (Exception e) {
// ignore
}
}
示例4: dataEnd
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public Charset dataEnd() {
detector.dataEnd();
if (charset == null && statistics.isMostlyAscii()) {
report(Constants.CHARSET_WINDOWS_1252);
}
return charset;
}
示例5: SJISSMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public SJISSMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, sjisClassTable),
SJIS_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, sjisStateTable),
sjisCharLenTable,
Constants.CHARSET_SHIFT_JIS
);
}
示例6: UTF8SMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public UTF8SMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, utf8ClassTable),
UTF8_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, utf8StateTable),
utf8CharLenTable,
Constants.CHARSET_UTF_8
);
}
示例7: EUCTWSMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public EUCTWSMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, euctwClassTable),
EUCTW_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, euctwStateTable),
euctwCharLenTable,
Constants.CHARSET_EUC_TW
);
}
示例8: GB18030SMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public GB18030SMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, gb18030ClassTable),
GB18030_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, gb18030StateTable),
gb18030CharLenTable,
Constants.CHARSET_GB18030
);
}
示例9: ISO2022CNSMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public ISO2022CNSMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, iso2022cnClassTable),
ISO2022CN_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, iso2022cnStateTable),
iso2022cnCharLenTable,
Constants.CHARSET_ISO_2022_CN
);
}
示例10: EUCKRSMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public EUCKRSMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, euckrClassTable),
EUCKR_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, euckrStateTable),
euckrCharLenTable,
Constants.CHARSET_EUC_KR
);
}
示例11: ISO2022KRSMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public ISO2022KRSMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, iso2022krClassTable),
ISO2022KR_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, iso2022krStateTable),
iso2022krCharLenTable,
Constants.CHARSET_ISO_2022_KR
);
}
示例12: UCS2BESMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public UCS2BESMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, ucs2beClassTable),
UCS2BE_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, ucs2beStateTable),
ucs2beCharLenTable,
Constants.CHARSET_UTF_16BE
);
}
示例13: Big5SMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public Big5SMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, big5ClassTable),
BIG5_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, big5StateTable),
big5CharLenTable,
Constants.CHARSET_BIG5
);
}
示例14: HZSMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public HZSMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, hzsClassTable),
HZS_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, hzsStateTable),
hzsCharLenTable,
Constants.CHARSET_HZ_GB_2312
);
}
示例15: EUCJPSMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public EUCJPSMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, eucjpClassTable),
EUCJP_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, eucjpStateTable),
eucjpCharLenTable,
Constants.CHARSET_EUC_JP
);
}