Class CodePointUtilities


  • public class CodePointUtilities
    extends Object
    Creation-Date: 01.06.2006, 18:10:19
    Author:
    Thomas Morgner
    • Method Detail

      • isValidCodePoint

        public static boolean isValidCodePoint​(int cp)
      • toChars

        public static int toChars​(int cp,
                                  char[] buffer,
                                  int offset)
        Converts the given codepoint into the given character array. The return value indicates either success or failure. The conversion will fail, if the given array does not contain enough space for the decoded character. In that case either -1 (one char missing) or -2 (two chars missing) is returned. On success either 1 or 2 is returned to indicate the number of chars added.

        If the buffer has space for at least two chars, then the negative index will never be returned.

        Parameters:
        cp -
        buffer -
        offset -
        Returns:
        the number of chars added or the number of additional chars required.
      • charsToCodepoint

        public static int[] charsToCodepoint​(String text)
      • codepointToChars

        public static String codepointToChars​(int[] text)