com.google.common.base.Utf8.unpairedSurrogateMsg()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中com.google.common.base.Utf8.unpairedSurrogateMsg()方法的一些代码示例,展示了Utf8.unpairedSurrogateMsg()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utf8.unpairedSurrogateMsg()方法的具体详情如下:
包路径:com.google.common.base.Utf8
类名称:Utf8
方法名:unpairedSurrogateMsg

Utf8.unpairedSurrogateMsg介绍

暂无

代码示例

代码示例来源:origin: google/guava

private static int encodedLengthGeneral(CharSequence sequence, int start) {
 int utf16Length = sequence.length();
 int utf8Length = 0;
 for (int i = start; i < utf16Length; i++) {
  char c = sequence.charAt(i);
  if (c < 0x800) {
   utf8Length += (0x7f - c) >>> 31; // branch free!
  } else {
   utf8Length += 2;
   // jdk7+: if (Character.isSurrogate(c)) {
   if (MIN_SURROGATE <= c && c <= MAX_SURROGATE) {
    // Check that we have a well-formed surrogate pair.
    if (Character.codePointAt(sequence, i) == c) {
     throw new IllegalArgumentException(unpairedSurrogateMsg(i));
    }
    i++;
   }
  }
 }
 return utf8Length;
}

代码示例来源:origin: google/j2objc

private static int encodedLengthGeneral(CharSequence sequence, int start) {
 int utf16Length = sequence.length();
 int utf8Length = 0;
 for (int i = start; i < utf16Length; i++) {
  char c = sequence.charAt(i);
  if (c < 0x800) {
   utf8Length += (0x7f - c) >>> 31; // branch free!
  } else {
   utf8Length += 2;
   // jdk7+: if (Character.isSurrogate(c)) {
   if (MIN_SURROGATE <= c && c <= MAX_SURROGATE) {
    // Check that we have a well-formed surrogate pair.
    if (Character.codePointAt(sequence, i) == c) {
     throw new IllegalArgumentException(unpairedSurrogateMsg(i));
    }
    i++;
   }
  }
 }
 return utf8Length;
}

代码示例来源:origin: wildfly/wildfly

private static int encodedLengthGeneral(CharSequence sequence, int start) {
 int utf16Length = sequence.length();
 int utf8Length = 0;
 for (int i = start; i < utf16Length; i++) {
  char c = sequence.charAt(i);
  if (c < 0x800) {
   utf8Length += (0x7f - c) >>> 31; // branch free!
  } else {
   utf8Length += 2;
   // jdk7+: if (Character.isSurrogate(c)) {
   if (MIN_SURROGATE <= c && c <= MAX_SURROGATE) {
    // Check that we have a well-formed surrogate pair.
    if (Character.codePointAt(sequence, i) == c) {
     throw new IllegalArgumentException(unpairedSurrogateMsg(i));
    }
    i++;
   }
  }
 }
 return utf8Length;
}

代码示例来源:origin: com.diffplug.guava/guava-core

private static int encodedLengthGeneral(CharSequence sequence, int start) {
  int utf16Length = sequence.length();
  int utf8Length = 0;
  for (int i = start; i < utf16Length; i++) {
    char c = sequence.charAt(i);
    if (c < 0x800) {
      utf8Length += (0x7f - c) >>> 31; // branch free!
    } else {
      utf8Length += 2;
      // jdk7+: if (Character.isSurrogate(c)) {
      if (MIN_SURROGATE <= c && c <= MAX_SURROGATE) {
        // Check that we have a well-formed surrogate pair.
        if (Character.codePointAt(sequence, i) == c) {
          throw new IllegalArgumentException(unpairedSurrogateMsg(i));
        }
        i++;
      }
    }
  }
  return utf8Length;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

private static int encodedLengthGeneral(CharSequence sequence, int start) {
 int utf16Length = sequence.length();
 int utf8Length = 0;
 for (int i = start; i < utf16Length; i++) {
  char c = sequence.charAt(i);
  if (c < 0x800) {
   utf8Length += (0x7f - c) >>> 31; // branch free!
  } else {
   utf8Length += 2;
   // jdk7+: if (Character.isSurrogate(c)) {
   if (MIN_SURROGATE <= c && c <= MAX_SURROGATE) {
    // Check that we have a well-formed surrogate pair.
    if (Character.codePointAt(sequence, i) == c) {
     throw new IllegalArgumentException(unpairedSurrogateMsg(i));
    }
    i++;
   }
  }
 }
 return utf8Length;
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

private static int encodedLengthGeneral(CharSequence sequence, int start) {
 int utf16Length = sequence.length();
 int utf8Length = 0;
 for (int i = start; i < utf16Length; i++) {
  char c = sequence.charAt(i);
  if (c < 0x800) {
   utf8Length += (0x7f - c) >>> 31; // branch free!
  } else {
   utf8Length += 2;
   // jdk7+: if (Character.isSurrogate(c)) {
   if (MIN_SURROGATE <= c && c <= MAX_SURROGATE) {
    // Check that we have a well-formed surrogate pair.
    if (Character.codePointAt(sequence, i) == c) {
     throw new IllegalArgumentException(unpairedSurrogateMsg(i));
    }
    i++;
   }
  }
 }
 return utf8Length;
}

相关文章