本文整理汇总了Java中org.jcodings.specific.UTF8Encoding.INSTANCE属性的典型用法代码示例。如果您正苦于以下问题:Java UTF8Encoding.INSTANCE属性的具体用法?Java UTF8Encoding.INSTANCE怎么用?Java UTF8Encoding.INSTANCE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jcodings.specific.UTF8Encoding
的用法示例。
在下文中一共展示了UTF8Encoding.INSTANCE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Grok
@SuppressWarnings("unchecked")
Grok(Map<String, String> patternBank, String grokPattern, boolean namedCaptures) {
this.patternBank = patternBank;
this.namedCaptures = namedCaptures;
this.expression = toRegex(grokPattern);
byte[] expressionBytes = expression.getBytes(StandardCharsets.UTF_8);
this.compiledExpression = new Regex(expressionBytes, 0, expressionBytes.length, Option.DEFAULT, UTF8Encoding.INSTANCE);
}
示例2: OnigRegExp
public OnigRegExp(String source) {
lastSearchStrUniqueId = null;
lastSearchPosition = -1;
lastSearchResult = null;
byte[] pattern = source.getBytes(StandardCharsets.UTF_8);
this.regex = new Regex(pattern, 0, pattern.length, Option.CAPTURE_GROUP, UTF8Encoding.INSTANCE, Syntax.DEFAULT,
WarnCallback.DEFAULT);
}
示例3: RegexpOpExp
public RegexpOpExp(ParserLiteral left, ParserLiteral right, int operator)
{
super(left, right, operator);
byte[] pattern = (((StringLiteral)right).val).getBytes(StandardCharsets.UTF_8);
this.regex = new Regex(pattern, 0, pattern.length, Option.NONE, UTF8Encoding.INSTANCE);
if (! left.isString()) {
throw new ConfigException(String.format("\"%s\" is not a String column", ((IdentifierLiteral)left).name));
}
}
示例4: getSingleModuleForPath
private List<Module> getSingleModuleForPath(File child) {
if(child.getName().endsWith(".rb")) {
try {
@SuppressWarnings("unchecked")
List<String> lines = FileUtils.readLines(child);
if(lines.size() > 1) {
String regex = lines.get(0);
regex = regex.substring(1, regex.length()).trim();
String triggers = lines.get(1);
triggers = triggers.substring(1, triggers.length()).trim();
String filename = child.getName();
String name = filename.substring(0, filename.length() - 3);
MewtwoMain.mewtwoLogger.info("Adding module " + name + " - regex = " + regex +
", triggers = "+ triggers);
Module m = new Module(
new Regex(regex.getBytes(), 0, regex.length(), Option.NONE, UTF8Encoding.INSTANCE),
Arrays.asList(triggers.split(",")), filename.substring(0, filename.length() - 3),
filename);
return Arrays.asList(m);
} else MewtwoMain.mewtwoLogger.info("Skipping file " + child.getAbsolutePath() + " - shorter than two lines!");
} catch (Throwable t) {
MewtwoMain.mewtwoLogger.error("Exception while parsing modules for " + child.getAbsolutePath() + "! ", t);
}
} else MewtwoMain.mewtwoLogger.info("Skipping file " + child.getAbsolutePath() + " - not a ruby file!");
return Arrays.asList();
}
示例5: convertJavaStringToRuby
private static IRubyObject convertJavaStringToRuby(Ruby runtime, String str) {
if (runtime.is1_9()) {
ByteList bytes = new ByteList(str.getBytes(RubyEncoding.UTF8), UTF8Encoding.INSTANCE);
return RubyString.newString(runtime, bytes);
} else {
return RubyString.newString(runtime, str);
}
}
示例6: generate
@Override
protected Regex generate(String i) {
byte[] pattern = i.getBytes();
return new Regex(pattern, 0, pattern.length, Option.NONE, UTF8Encoding.INSTANCE);
}