當前位置: 首頁>>代碼示例>>Java>>正文


Java Utf16Util.isValidUtf16方法代碼示例

本文整理匯總了Java中org.waveprotocol.wave.model.util.Utf16Util.isValidUtf16方法的典型用法代碼示例。如果您正苦於以下問題:Java Utf16Util.isValidUtf16方法的具體用法?Java Utf16Util.isValidUtf16怎麽用?Java Utf16Util.isValidUtf16使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.waveprotocol.wave.model.util.Utf16Util的用法示例。


在下文中一共展示了Utf16Util.isValidUtf16方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkAttributesUpdateWellFormed

import org.waveprotocol.wave.model.util.Utf16Util; //導入方法依賴的package包/類
private ValidationResult checkAttributesUpdateWellFormed(AttributesUpdate u,
    ViolationCollector v) {
  if (u == null) { return nullAttributesUpdate(v); }
  String previousKey = null;
  for (int i = 0; i < u.changeSize(); i++) {
    String key = u.getChangeKey(i);
    if (key == null) { return nullAttributeKey(v); }
    if (!Utf16Util.isXmlName(key)) { return attributeNameNotXmlName(v, key); }
    if (previousKey != null && previousKey.compareTo(key) >= 0) {
      return attributeKeysNotStrictlyMonotonic(v, previousKey, key);
    }
    if (u.getOldValue(i) != null && !Utf16Util.isValidUtf16(u.getOldValue(i))) {
      return attributeValueNotValidUtf16(v);
    }
    if (u.getNewValue(i) != null && !Utf16Util.isValidUtf16(u.getNewValue(i))) {
      return attributeValueNotValidUtf16(v);
    }
    previousKey = key;
  }
  return ValidationResult.VALID;
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:22,代碼來源:DocOpAutomaton.java

示例2: checkDeleteCharacters

import org.waveprotocol.wave.model.util.Utf16Util; //導入方法依賴的package包/類
public ValidationResult checkDeleteCharacters(String chars, ViolationCollector v) {
  // well-formedness
  if (chars == null) { return nullCharacters(v); }
  if (chars.isEmpty()) { return emptyCharacters(v); }
  if (Utf16Util.firstSurrogate(chars) != -1) { return deleteCharactersContainsSurrogate(v); }
  if (!Utf16Util.isValidUtf16(chars)) { return deleteCharactersInvalidUnicode(v); }
  if (!insertionStackIsEmpty()) { return deleteInsideInsert(v); }
  // validity
  int docLength = doc.length();
  for (int offset = 0; offset < chars.length(); offset++) {
    if (effectivePos + offset >= docLength) {
      return cannotDeleteSoManyCharacters(v, offset, chars);
    }
    int charHereIfAny = doc.charAt(effectivePos + offset);
    if (charHereIfAny == -1) {
      return cannotDeleteSoManyCharacters(v, offset, chars);
    }
    char charHere = (char) charHereIfAny;
    if (charHere != chars.charAt(offset)) {
      return oldCharacterDiffersFromDocument(v, charHere, chars.charAt(offset));
    }
  }
  return checkAnnotationsForDeletion(v, chars.length());
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:25,代碼來源:DocOpAutomaton.java

示例3: StreamingXmlParser

import org.waveprotocol.wave.model.util.Utf16Util; //導入方法依賴的package包/類
StreamingXmlParser(String xml) throws XmlParseException {
  // Ensure that the input is valid UTF-16 here, makes rest of the code
  // simpler
  if (Utf16Util.isValidUtf16(xml)) {
    buffer = new Buffer(xml);
  } else {
    throw new XmlParseException("Input is not valid UTF-16: " + xml);
  }
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:10,代碼來源:StreamingXmlParser.java

示例4: checkAttributesWellFormed

import org.waveprotocol.wave.model.util.Utf16Util; //導入方法依賴的package包/類
private ValidationResult checkAttributesWellFormed(Attributes attr, ViolationCollector v) {
  if (attr == null) { return nullAttributes(v); }
  String previousKey = null;
  for (Map.Entry<String, String> e : attr.entrySet()) {
    if (e.getKey() == null) { return nullAttributeKey(v); }
    if (!Utf16Util.isXmlName(e.getKey())) { return attributeNameNotXmlName(v, e.getKey()); }
    if (e.getValue() == null) { return nullAttributeValue(v); }
    if (!Utf16Util.isValidUtf16(e.getValue())) { return attributeValueNotValidUtf16(v); }
    if (previousKey != null && previousKey.compareTo(e.getKey()) >= 0) {
      return attributeKeysNotStrictlyMonotonic(v, previousKey, e.getKey());
    }
    previousKey = e.getKey();
  }
  return ValidationResult.VALID;
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:16,代碼來源:DocOpAutomaton.java

示例5: validateAnnotationKey

import org.waveprotocol.wave.model.util.Utf16Util; //導入方法依賴的package包/類
private ValidationResult validateAnnotationKey(String key, ViolationCollector v) {
  if (key == null) { return nullAnnotationKey(v); }
  if (key.contains("?") || key.contains("@")) { return invalidCharacterInAnnotationKey(v, key); }
  if (!Utf16Util.isValidUtf16(key)) { return annotationKeyNotValidUtf16(v); }
  return ValidationResult.VALID;
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:7,代碼來源:DocOpAutomaton.java

示例6: validateAnnotationValue

import org.waveprotocol.wave.model.util.Utf16Util; //導入方法依賴的package包/類
private ValidationResult validateAnnotationValue(String value, ViolationCollector v) {
if (value == null) { return ValidationResult.VALID; }
if (!Utf16Util.isValidUtf16(value)) { return annotationValueNotValidUtf16(v); }
  return ValidationResult.VALID;
}
 
開發者ID:jorkey,項目名稱:Wiab.pro,代碼行數:6,代碼來源:DocOpAutomaton.java

示例7: validateAnnotationValue

import org.waveprotocol.wave.model.util.Utf16Util; //導入方法依賴的package包/類
private ValidationResult validateAnnotationValue(String value, ViolationCollector v) {
  if (value == null) { return ValidationResult.VALID; }
  if (!Utf16Util.isValidUtf16(value)) { return annotationValueNotValidUtf16(v); }
  return ValidationResult.VALID;
}
 
開發者ID:apache,項目名稱:incubator-wave,代碼行數:6,代碼來源:DocOpAutomaton.java


注:本文中的org.waveprotocol.wave.model.util.Utf16Util.isValidUtf16方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。