Example usage for java.lang Character toChars

List of usage examples for java.lang Character toChars

Introduction

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

Prototype

public static int toChars(int codePoint, char[] dst, int dstIndex) 

Source Link

Document

Converts the specified character (Unicode code point) to its UTF-16 representation.

Usage

From source file:android.support.text.emoji.MetadataRepo.java

/**
 * Read emoji metadata list and construct the trie.
 *//*ww  w.  j  a  va2s.c  om*/
private void constructIndex(final MetadataList metadataList) {
    int length = metadataList.listLength();
    for (int i = 0; i < length; i++) {
        final EmojiMetadata metadata = new EmojiMetadata(this, i);
        //since all emojis are mapped to a single codepoint in Private Use Area A they are 2
        //chars wide
        //noinspection ResultOfMethodCallIgnored
        Character.toChars(metadata.getId(), mEmojiCharArray, i * 2);
        put(metadata);
    }
}