本文整理汇总了Java中org.mozilla.universalchardet.Constants类的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Constants类属于org.mozilla.universalchardet包,在下文中一共展示了Constants类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:27,代码来源:UniversalEncodingListener.java
示例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";
}
开发者ID:PTCE,项目名称:popcorn-android,代码行数:22,代码来源:FileUtils.java
示例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
}
}
开发者ID:crysehillmes,项目名称:smoothnovelreader,代码行数:26,代码来源:UniversalEncodingListener.java
示例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;
}
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:8,代码来源:UniversalEncodingListener.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:SJISSMModel.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:UTF8SMModel.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:EUCTWSMModel.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:GB18030SMModel.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:ISO2022CNSMModel.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:EUCKRSMModel.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:ISO2022KRSMModel.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:UCS2BESMModel.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:Big5SMModel.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:HZSMModel.java
示例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
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:EUCJPSMModel.java
示例16: ISO2022JPSMModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public ISO2022JPSMModel()
{
super(
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, iso2022jpClassTable),
ISO2022JP_CLASS_FACTOR,
new PkgInt(INDEX_SHIFT_4BITS, SHIFT_MASK_4BITS, BIT_SHIFT_4BITS, UNIT_MASK_4BITS, iso2022jpStateTable),
iso2022jpCharLenTable,
Constants.CHARSET_ISO_2022_JP
);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:11,代码来源:ISO2022JPSMModel.java
示例17: HebrewModel
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public HebrewModel()
{
super(
win1255CharToOrderMap,
hebrewLangModel,
TYPICAL_POSITIVE_RATIO,
false,
Constants.CHARSET_WINDOWS_1255);
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:10,代码来源:HebrewModel.java
示例18: getCharSetName
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
@Override
public String getCharSetName()
{
// If the final letter score distance is dominant enough, rely on it.
int finalsub = this.finalCharLogicalScore - this.finalCharVisualScore;
if (finalsub >= MIN_FINAL_CHAR_DISTANCE) {
return Constants.CHARSET_WINDOWS_1255;
}
if (finalsub <= -MIN_FINAL_CHAR_DISTANCE) {
return Constants.CHARSET_ISO_8859_8;
}
// It's not dominant enough, try to rely on the model scores instead.
float modelsub = this.logicalProber.getConfidence() - this.visualProber.getConfidence();
if (modelsub > MIN_MODEL_DISTANCE) {
return Constants.CHARSET_WINDOWS_1255;
}
if (modelsub < -MIN_MODEL_DISTANCE) {
return Constants.CHARSET_ISO_8859_8;
}
// Still no good, back to final letter distance, maybe it'll save the day.
if (finalsub < 0) {
return Constants.CHARSET_ISO_8859_8;
}
// (finalsub > 0 - Logical) or (don't know what to do) default to Logical.
return Constants.CHARSET_WINDOWS_1255;
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:30,代码来源:HebrewProber.java
示例19: getCharSetName
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
public String getCharSetName()
{
return Constants.CHARSET_UTF_8;
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:5,代码来源:UTF8Prober.java
示例20: getCharSetName
import org.mozilla.universalchardet.Constants; //导入依赖的package包/类
@Override
public String getCharSetName()
{
return Constants.CHARSET_EUC_TW;
}
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:6,代码来源:EUCTWProber.java
注:本文中的org.mozilla.universalchardet.Constants类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论