java.lang.Character.isDefined()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(222)

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

Character.isDefined介绍

[英]Indicates whether the specified character is defined in the Unicode specification.
[中]指示指定的字符是否在Unicode规范中定义。

代码示例

代码示例来源:origin: goldmansachs/gs-collections

public boolean accept(char character)
  {
    return !Character.isDefined(character);
  }
};

代码示例来源:origin: goldmansachs/gs-collections

public boolean accept(char value)
  {
    return !Character.isDefined(value);
  }
}

代码示例来源:origin: goldmansachs/gs-collections

public boolean accept(int codePoint)
  {
    return !Character.isDefined(codePoint);
  }
};

代码示例来源:origin: eclipse/eclipse-collections

public boolean accept(int codePoint)
  {
    return !Character.isDefined(codePoint);
  }
};

代码示例来源:origin: konsoletyper/teavm

@Override
  public boolean contains(int ch) {
    return Character.isDefined(ch);
  }
};

代码示例来源:origin: eclipse/eclipse-collections

@Override
  public boolean accept(char value)
  {
    return !Character.isDefined(value);
  }
}

代码示例来源:origin: eclipse/eclipse-collections

public boolean accept(char character)
  {
    return !Character.isDefined(character);
  }
};

代码示例来源:origin: eclipse/eclipse-collections

@Override
  public boolean accept(char value)
  {
    return !Character.isDefined(value);
  }
}

代码示例来源:origin: eclipse/eclipse-collections

public boolean accept(int codePoint)
  {
    return !Character.isDefined(codePoint);
  }
};

代码示例来源:origin: eclipse/eclipse-collections

public boolean accept(char character)
  {
    return !Character.isDefined(character);
  }
};

代码示例来源:origin: org.testng/testng

public static String escapeUnicode(String s) {
 if (s == null) {
  return null;
 }
 StringBuilder result = new StringBuilder();
 for (int i = 0; i < s.length(); i++) {
  char c = s.charAt(i);
  char ca = Character.isDefined(c) ? c: UNICODE_REPLACEMENT;
  result.append(ca);
 }
 return result.toString();
}

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

public boolean isOk() {
  for (char c : secret.toCharArray()) {
    if ((int) c > 256) {
      return false;
    }
    if (Character.isDefined(c) == false) {
      return false;
    }
    if (Character.isISOControl(c)) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: cbeust/testng

public static String escapeUnicode(String s) {
 if (s == null) {
  return null;
 }
 StringBuilder result = new StringBuilder();
 for (int i = 0; i < s.length(); i++) {
  char c = s.charAt(i);
  char ca = Character.isDefined(c) ? c : UNICODE_REPLACEMENT;
  result.append(ca);
 }
 return result.toString();
}

代码示例来源:origin: SonarSource/sonarqube

@Override
 public Object resolveEntity(String arg0, String arg1, String fileName, String undeclaredEntity) throws XMLStreamException {
  // avoid problems with XML docs containing undeclared entities.. return the entity under its raw form if not an unicode expression
  if (StringUtils.startsWithIgnoreCase(undeclaredEntity, "u") && undeclaredEntity.length() == 5) {
   int unicodeCharHexValue = Integer.parseInt(undeclaredEntity.substring(1), 16);
   if (Character.isDefined(unicodeCharHexValue)) {
    undeclaredEntity = new String(new char[] {(char) unicodeCharHexValue});
   }
  }
  return undeclaredEntity;
 }
}

代码示例来源:origin: prestodb/presto

/**
 * @param bindex Relative index within base64 character unit; between 0
 *   and 3 (as unit has exactly 4 characters)
 */
protected IllegalArgumentException reportInvalidBase64Char(Base64Variant b64variant, int ch, int bindex, String msg) throws IllegalArgumentException {
  String base;
  if (ch <= INT_SPACE) {
    base = String.format("Illegal white space character (code 0x%s) as character #%d of 4-char base64 unit: can only used between units",
        Integer.toHexString(ch), (bindex+1));
  } else if (b64variant.usesPaddingChar(ch)) {
    base = "Unexpected padding character ('"+b64variant.getPaddingChar()+"') as character #"+(bindex+1)+" of 4-char base64 unit: padding only legal as 3rd or 4th character";
  } else if (!Character.isDefined(ch) || Character.isISOControl(ch)) {
    // Not sure if we can really get here... ? (most illegal xml chars are caught at lower level)
    base = "Illegal character (code 0x"+Integer.toHexString(ch)+") in base64 content";
  } else {
    base = "Illegal character '"+((char)ch)+"' (code 0x"+Integer.toHexString(ch)+") in base64 content";
  }
  if (msg != null) {
    base = base + ": " + msg;
  }
  return new IllegalArgumentException(base);
}

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

/**
 * @param bindex Relative index within base64 character unit; between 0
 *   and 3 (as unit has exactly 4 characters)
 */
protected IllegalArgumentException reportInvalidBase64Char(Base64Variant b64variant, int ch, int bindex, String msg) throws IllegalArgumentException {
  String base;
  if (ch <= INT_SPACE) {
    base = String.format("Illegal white space character (code 0x%s) as character #%d of 4-char base64 unit: can only used between units",
        Integer.toHexString(ch), (bindex+1));
  } else if (b64variant.usesPaddingChar(ch)) {
    base = "Unexpected padding character ('"+b64variant.getPaddingChar()+"') as character #"+(bindex+1)+" of 4-char base64 unit: padding only legal as 3rd or 4th character";
  } else if (!Character.isDefined(ch) || Character.isISOControl(ch)) {
    // Not sure if we can really get here... ? (most illegal xml chars are caught at lower level)
    base = "Illegal character (code 0x"+Integer.toHexString(ch)+") in base64 content";
  } else {
    base = "Illegal character '"+((char)ch)+"' (code 0x"+Integer.toHexString(ch)+") in base64 content";
  }
  if (msg != null) {
    base = base + ": " + msg;
  }
  return new IllegalArgumentException(base);
}

代码示例来源:origin: prestodb/presto

/**
 * @param bindex Relative index within base64 character unit; between 0
 *   and 3 (as unit has exactly 4 characters)
 */
protected void _reportInvalidBase64(char ch, int bindex, String msg)
  throws IllegalArgumentException
{
  String base;
  if (ch <= INT_SPACE) {
    base = "Illegal white space character (code 0x"+Integer.toHexString(ch)+") as character #"+(bindex+1)+" of 4-char base64 unit: can only used between units";
  } else if (usesPaddingChar(ch)) {
    base = "Unexpected padding character ('"+getPaddingChar()+"') as character #"+(bindex+1)+" of 4-char base64 unit: padding only legal as 3rd or 4th character";
  } else if (!Character.isDefined(ch) || Character.isISOControl(ch)) {
    // Not sure if we can really get here... ? (most illegal xml chars are caught at lower level)
    base = "Illegal character (code 0x"+Integer.toHexString(ch)+") in base64 content";
  } else {
    base = "Illegal character '"+ch+"' (code 0x"+Integer.toHexString(ch)+") in base64 content";
  }
  if (msg != null) {
    base = base + ": " + msg;
  }
  throw new IllegalArgumentException(base);
}

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

/**
 * @param bindex Relative index within base64 character unit; between 0
 *   and 3 (as unit has exactly 4 characters)
 */
protected void _reportInvalidBase64(char ch, int bindex, String msg)
  throws IllegalArgumentException
{
  String base;
  if (ch <= INT_SPACE) {
    base = "Illegal white space character (code 0x"+Integer.toHexString(ch)+") as character #"+(bindex+1)+" of 4-char base64 unit: can only used between units";
  } else if (usesPaddingChar(ch)) {
    base = "Unexpected padding character ('"+getPaddingChar()+"') as character #"+(bindex+1)+" of 4-char base64 unit: padding only legal as 3rd or 4th character";
  } else if (!Character.isDefined(ch) || Character.isISOControl(ch)) {
    // Not sure if we can really get here... ? (most illegal xml chars are caught at lower level)
    base = "Illegal character (code 0x"+Integer.toHexString(ch)+") in base64 content";
  } else {
    base = "Illegal character '"+ch+"' (code 0x"+Integer.toHexString(ch)+") in base64 content";
  }
  if (msg != null) {
    base = base + ": " + msg;
  }
  throw new IllegalArgumentException(base);
}

代码示例来源:origin: apache/hive

private static String composeString(int len, Random r) {
 char[] cc = new char[len];
 char ch;
 for (int i = 0; i<len; i++) {
  do {
   ch = (char)r.nextInt();
  } while (!Character.isDefined(ch) 
    || Character.isHighSurrogate(ch)
    || Character.isLowSurrogate(ch));
  cc[i] = ch;
 }
 return new String(cc);
}

代码示例来源:origin: jphp-group/jphp

@FastMethod
@Signature(@Arg("char"))
public static Memory isDefined(Environment env, Memory... args) {
  return Character.isDefined(chr(args[0])) ? Memory.TRUE : Memory.FALSE;
}

相关文章

Character类方法