本文整理汇总了Java中org.apache.lucene.util.UnicodeUtil.MAX_UTF8_BYTES_PER_CHAR属性的典型用法代码示例。如果您正苦于以下问题:Java UnicodeUtil.MAX_UTF8_BYTES_PER_CHAR属性的具体用法?Java UnicodeUtil.MAX_UTF8_BYTES_PER_CHAR怎么用?Java UnicodeUtil.MAX_UTF8_BYTES_PER_CHAR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.lucene.util.UnicodeUtil
的用法示例。
在下文中一共展示了UnicodeUtil.MAX_UTF8_BYTES_PER_CHAR属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
@Override
public BytesRef evaluate(Input<Object>... args) {
Object stringValue = args[0].value();
if (stringValue == null) {
return null;
}
BytesRef inputByteRef = BytesRefs.toBytesRef(stringValue);
char[] ref = new char[inputByteRef.length];
int len = UnicodeUtil.UTF8toUTF16(inputByteRef.bytes, inputByteRef.offset, inputByteRef.length, ref);
charUtils.toLowerCase(ref, 0, len);
byte[] res = new byte[UnicodeUtil.MAX_UTF8_BYTES_PER_CHAR * len];
len = UnicodeUtil.UTF16toUTF8(ref, 0, len, res);
return new BytesRef(res, 0, len);
}
示例2: evaluate
@Override
public BytesRef evaluate(Input<Object>... args) {
Object stringValue = args[0].value();
if (stringValue == null) {
return null;
}
BytesRef inputByteRef = BytesRefs.toBytesRef(stringValue);
char[] ref = new char[inputByteRef.length];
int len = UnicodeUtil.UTF8toUTF16(inputByteRef.bytes, inputByteRef.offset, inputByteRef.length, ref);
charUtils.toUpperCase(ref, 0, len);
byte[] res = new byte[UnicodeUtil.MAX_UTF8_BYTES_PER_CHAR * len];
len = UnicodeUtil.UTF16toUTF8(ref, 0, len, res);
return new BytesRef(res, 0, len);
}
示例3: compressString
/** Compresses the String value using the specified
* compressionLevel (constants are defined in
* java.util.zip.Deflater). */
public static byte[] compressString(String value, int compressionLevel) {
byte[] b = new byte[UnicodeUtil.MAX_UTF8_BYTES_PER_CHAR * value.length()];
final int len = UnicodeUtil.UTF16toUTF8(value, 0, value.length(), b);
return compress(b, 0, len, compressionLevel);
}
示例4: matches
private boolean matches(ByteRunAutomaton a, int code) {
char[] chars = Character.toChars(code);
byte[] b = new byte[UnicodeUtil.MAX_UTF8_BYTES_PER_CHAR * chars.length];
final int len = UnicodeUtil.UTF16toUTF8(chars, 0, chars.length, b);
return a.run(b, 0, len);
}