本文整理匯總了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));
}