本文整理汇总了Java中org.waveprotocol.wave.model.util.Utf16Util.traverseUtf16String方法的典型用法代码示例。如果您正苦于以下问题:Java Utf16Util.traverseUtf16String方法的具体用法?Java Utf16Util.traverseUtf16String怎么用?Java Utf16Util.traverseUtf16String使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.waveprotocol.wave.model.util.Utf16Util
的用法示例。
在下文中一共展示了Utf16Util.traverseUtf16String方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractCodePoints
import org.waveprotocol.wave.model.util.Utf16Util; //导入方法依赖的package包/类
/**
* Extracts code points from a given character string.
*
* @param chars a character string from which to extract code points
* @return the code points extracted from the given string
*/
private static List<Integer> extractCodePoints(String chars) throws InvalidSchemaException {
List<Integer> codePoints = Utf16Util.traverseUtf16String(chars, codePointExtractor);
if (codePoints == ERROR_LIST) {
throw new InvalidSchemaException("Invalid code point in string: " + chars);
}
return codePoints;
}
示例2: isValidIdentifier
import org.waveprotocol.wave.model.util.Utf16Util; //导入方法依赖的package包/类
/**
* Checks whether a UTF-16 string is a valid wave identifier.
*/
public static boolean isValidIdentifier(String id) {
return !id.isEmpty() && Utf16Util.traverseUtf16String(id, GOOD_UTF16_FOR_ID);
}
示例3: validate
import org.waveprotocol.wave.model.util.Utf16Util; //导入方法依赖的package包/类
/**
* Checks whether the given characters are valid.
*
* @param characters the characters to check
* @return -1 if the characters are all valid, or otherwise the number of
* valid Unicode characters before the first invalid character
*/
int validate(String characters) {
return Utf16Util.traverseUtf16String(characters, new ValidatingHandler(predicate));
}