Class UTF16


  • public class UTF16
    extends java.lang.Object
    A class to hold some static constants and methods associated with processing UTF16 and surrogate pairs
    • Constructor Summary

      Constructors 
      Constructor Description
      UTF16()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int combinePair​(char high, char low)
      Return the non-BMP character corresponding to a given surrogate pair surrogates.
      static char highSurrogate​(int ch)
      Return the high surrogate of a non-BMP character
      static boolean isHighSurrogate​(int ch)
      Test whether the given character is a high surrogate
      static boolean isLowSurrogate​(int ch)
      Test whether the given character is a low surrogate
      static boolean isSurrogate​(int c)
      Test whether a given character is a surrogate (high or low)
      static char lowSurrogate​(int ch)
      Return the low surrogate of a non-BMP character
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UTF16

        public UTF16()
    • Method Detail

      • combinePair

        public static int combinePair​(char high,
                                      char low)
        Return the non-BMP character corresponding to a given surrogate pair surrogates.
        Parameters:
        high - The high surrogate.
        low - The low surrogate.
        Returns:
        the Unicode codepoint represented by the surrogate pair
      • highSurrogate

        public static char highSurrogate​(int ch)
        Return the high surrogate of a non-BMP character
        Parameters:
        ch - The Unicode codepoint of the non-BMP character to be divided.
        Returns:
        the first character in the surrogate pair
      • lowSurrogate

        public static char lowSurrogate​(int ch)
        Return the low surrogate of a non-BMP character
        Parameters:
        ch - The Unicode codepoint of the non-BMP character to be divided.
        Returns:
        the second character in the surrogate pair
      • isSurrogate

        public static boolean isSurrogate​(int c)
        Test whether a given character is a surrogate (high or low)
        Parameters:
        c - the character to test
        Returns:
        true if the character is the high or low half of a surrogate pair
      • isHighSurrogate

        public static boolean isHighSurrogate​(int ch)
        Test whether the given character is a high surrogate
        Parameters:
        ch - The character to test.
        Returns:
        true if the character is the first character in a surrogate pair
      • isLowSurrogate

        public static boolean isLowSurrogate​(int ch)
        Test whether the given character is a low surrogate
        Parameters:
        ch - The character to test.
        Returns:
        true if the character is the second character in a surrogate pair