net.sf.saxon.charcode

Class UTF16CharacterSet

public class UTF16CharacterSet extends Object implements CharacterSet

A class to hold some static constants and methods associated with processing UTF16 and surrogate pairs
Field Summary
static intNONBMP_MAX
static intNONBMP_MIN
static charSURROGATE1_MAX
static charSURROGATE1_MIN
static charSURROGATE2_MAX
static charSURROGATE2_MIN
Method Summary
static intcombinePair(char high, char low)
Return the non-BMP character corresponding to a given surrogate pair surrogates.
StringgetCanonicalName()
static UTF16CharacterSetgetInstance()
Get the singular instance of this class
static charhighSurrogate(int ch)
Return the high surrogate of a non-BMP character
booleaninCharset(int c)
static booleanisHighSurrogate(int ch)
Test whether the given character is a high surrogate
static booleanisLowSurrogate(int ch)
Test whether the given character is a low surrogate
static booleanisSurrogate(int c)
Test whether a given character is a surrogate (high or low)
static charlowSurrogate(int ch)
Return the low surrogate of a non-BMP character

Field Detail

NONBMP_MAX

public static final int NONBMP_MAX

NONBMP_MIN

public static final int NONBMP_MIN

SURROGATE1_MAX

public static final char SURROGATE1_MAX

SURROGATE1_MIN

public static final char SURROGATE1_MIN

SURROGATE2_MAX

public static final char SURROGATE2_MAX

SURROGATE2_MIN

public static final char SURROGATE2_MIN

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

getCanonicalName

public String getCanonicalName()

getInstance

public static UTF16CharacterSet getInstance()
Get the singular instance of this class

Returns: the singular instance of this classthe singular instance of this class

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

inCharset

public boolean inCharset(int c)

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

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

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