Example usage for java.lang Character isBmpCodePoint

List of usage examples for java.lang Character isBmpCodePoint

Introduction

In this page you can find the example usage for java.lang Character isBmpCodePoint.

Prototype

public static boolean isBmpCodePoint(int codePoint) 

Source Link

Document

Determines whether the specified character (Unicode code point) is in the Basic Multilingual Plane (BMP).

Usage

From source file:Main.java

public static void main(String[] args) {
    char cp1 = ' ', cp2 = 'A';

    boolean b1 = Character.isBmpCodePoint(cp1);

    System.out.println(b1);/*from   www.j  a  v  a 2s  . co  m*/
}

From source file:org.codelibs.fess.crawler.util.UnsafeStringBuilder.java

public StrBuilder appendCodePoint(int codePoint) {
    if (Character.isBmpCodePoint(codePoint)) {
        append((char) codePoint);
    } else if (Character.isValidCodePoint(codePoint)) {
        append(Character.highSurrogate(codePoint));
        append(Character.lowSurrogate(codePoint));
    } else {/*  ww  w.ja  v a  2s  . c o  m*/
        throw new IllegalArgumentException();
    }
    return this;
}

From source file:org.eclipse.rdf4j.rio.turtle.TurtleParser.java

/**
 * Appends the characters from codepoint into the string builder. This is
 * the same as Character#toChars but prevents the additional char array
 * garbage for BMP codepoints./*from  w  ww . j a  v  a  2s .c  o  m*/
 * 
 * @param dst
 *            the destination in which to append the characters
 * @param codePoint
 *            the codepoint to be appended
 */
private static void appendCodepoint(StringBuilder dst, int codePoint) {
    if (Character.isBmpCodePoint(codePoint)) {
        dst.append((char) codePoint);
    } else if (Character.isValidCodePoint(codePoint)) {
        dst.append(Character.highSurrogate(codePoint));
        dst.append(Character.lowSurrogate(codePoint));
    } else {
        throw new IllegalArgumentException("Invalid codepoint " + codePoint);
    }
}