| java.lang.Object com.ibm.icu.dev.test.UTF16Util
UTF16Util | public class UTF16Util (Code) | | Utility class for supplementary code point
support. This one is written purely for updating
Normalization sample from the unicode.org site.
If you want the real thing, use UTF16 class
from ICU4J
author: Vladimir Weinstein, Markus Scherer |
Method Summary | |
final public static void | appendCodePoint(StringBuffer buffer, int ch) Method appendCodePoint. | public static int | charAt(char source, int start, int limit, int offset16) Extract a single UTF-32 value from a substring.
Used when iterating forwards or backwards (with
UTF16.getCharCount() , as well as random access. | final public static int | codePointLength(int c) Method codePointLength. | final public static int | countCodePoint(String source) Method countCodePoint. | final public static int | countCodePoint(StringBuffer source) Method countCodePoint. | public static int | getCharCount(int char32) Determines how many chars this char32 requires.
If a validity check is required, use
isLegal() on
char32 before calling.
Parameters: char32 - the input codepoint. | public static int | getRawSupplementary(char lead, char trail) | final public static void | insertCodePoint(StringBuffer buffer, int i, int ch) Method insertCodePoint. | public static boolean | isLeadSurrogate(char char16) Determines whether the character is a lead surrogate.
Parameters: char16 - the input character. | public static boolean | isSurrogate(char char16) Determines whether the code value is a surrogate.
Parameters: char16 - the input character. | public static boolean | isTrailSurrogate(char char16) Determines whether the character is a trail surrogate.
Parameters: char16 - the input character. | final public static int | nextCodePoint(String s, int i) Method nextCodePoint. | final public static int | nextCodePoint(StringBuffer s, int i) Method nextCodePoint. | final public static int | prevCodePoint(String s, int i) Method prevCodePoint. | final public static int | prevCodePoint(StringBuffer s, int i) Method prevCodePoint. | final public static int | setCodePointAt(StringBuffer buffer, int i, int ch) Method setCodePointAt. |
LEAD_SURROGATE_MAX_VALUE | final public static int LEAD_SURROGATE_MAX_VALUE(Code) | | Lead surrogate maximum value
|
LEAD_SURROGATE_MIN_VALUE | final public static int LEAD_SURROGATE_MIN_VALUE(Code) | | Lead surrogate minimum value
|
SUPPLEMENTARY_MIN_VALUE | final public static int SUPPLEMENTARY_MIN_VALUE(Code) | | The minimum value for Supplementary code points
|
TRAIL_SURROGATE_MAX_VALUE | final public static int TRAIL_SURROGATE_MAX_VALUE(Code) | | Trail surrogate maximum value
|
TRAIL_SURROGATE_MIN_VALUE | final public static int TRAIL_SURROGATE_MIN_VALUE(Code) | | Trail surrogate minimum value
|
suppOffset | final static int suppOffset(Code) | | |
appendCodePoint | final public static void appendCodePoint(StringBuffer buffer, int ch)(Code) | | Method appendCodePoint. Appends a code point
to a StringBuffer
Parameters: buffer - StringBuffer in question Parameters: ch - code point to append |
charAt | public static int charAt(char source, int start, int limit, int offset16)(Code) | | Extract a single UTF-32 value from a substring.
Used when iterating forwards or backwards (with
UTF16.getCharCount() , as well as random access. If a
validity check is required, use
UCharacter.isLegal()
on the return value.
If the char retrieved is part of a surrogate pair, its supplementary
character will be returned. If a complete supplementary character is
not found the incomplete character will be returned
Parameters: source - array of UTF-16 chars Parameters: start - offset to substring in the source array for analyzing Parameters: limit - offset to substring in the source array for analyzing Parameters: offset16 - UTF-16 offset relative to start UTF-32 value for the UTF-32 value that contains the char atoffset16. The boundaries of that codepoint are the same as inbounds32() . exception: IndexOutOfBoundsException - thrown if offset16 is not within the range of start and limit. |
codePointLength | final public static int codePointLength(int c)(Code) | | Method codePointLength. Returns the length
in UTF-16 code units of a given code point
Parameters: c - code point in question int length in UTF-16 code units. Can be 1 or 2 |
countCodePoint | final public static int countCodePoint(String source)(Code) | | Method countCodePoint. Counts the UTF-32 code points
in a UTF-16 encoded string.
Parameters: source - String in question. int number of code points in this string |
countCodePoint | final public static int countCodePoint(StringBuffer source)(Code) | | Method countCodePoint. Counts the UTF-32 code points
in a UTF-16 encoded string.
Parameters: source - StringBuffer in question. int number of code points in this string |
getCharCount | public static int getCharCount(int char32)(Code) | | Determines how many chars this char32 requires.
If a validity check is required, use
isLegal() on
char32 before calling.
Parameters: char32 - the input codepoint. 2 if is in supplementary space, otherwise 1. |
getRawSupplementary | public static int getRawSupplementary(char lead, char trail)(Code) | | Forms a supplementary code point from the argument character
Note this is for internal use hence no checks for the validity of the
surrogate characters are done
Parameters: lead - lead surrogate character Parameters: trail - trailing surrogate character code point of the supplementary character |
insertCodePoint | final public static void insertCodePoint(StringBuffer buffer, int i, int ch)(Code) | | Method insertCodePoint. Inserts a code point in
a StringBuffer
Parameters: buffer - StringBuffer in question Parameters: i - index at which we want code point to be inserted Parameters: ch - code point to be inserted |
isLeadSurrogate | public static boolean isLeadSurrogate(char char16)(Code) | | Determines whether the character is a lead surrogate.
Parameters: char16 - the input character. true iff the input character is a lead surrogate |
isSurrogate | public static boolean isSurrogate(char char16)(Code) | | Determines whether the code value is a surrogate.
Parameters: char16 - the input character. true iff the input character is a surrogate. |
isTrailSurrogate | public static boolean isTrailSurrogate(char char16)(Code) | | Determines whether the character is a trail surrogate.
Parameters: char16 - the input character. true iff the input character is a trail surrogate. |
nextCodePoint | final public static int nextCodePoint(String s, int i)(Code) | | Method nextCodePoint. Returns the next code point
in a string.
Parameters: s - String in question Parameters: i - index from which we want a code point int codepoint at index i |
nextCodePoint | final public static int nextCodePoint(StringBuffer s, int i)(Code) | | Method nextCodePoint. Returns the next code point
in a string.
Parameters: s - StringBuffer in question Parameters: i - index from which we want a code point int codepoint at index i |
prevCodePoint | final public static int prevCodePoint(String s, int i)(Code) | | Method prevCodePoint. Gets the code point preceding
index i (predecrement).
Parameters: s - String in question Parameters: i - index in string int codepoint at index --i |
prevCodePoint | final public static int prevCodePoint(StringBuffer s, int i)(Code) | | Method prevCodePoint. Gets the code point preceding
index i (predecrement).
Parameters: s - StringBuffer in question Parameters: i - index in string int codepoint at index --i |
setCodePointAt | final public static int setCodePointAt(StringBuffer buffer, int i, int ch)(Code) | | Method setCodePointAt. Changes a code point at a
given index. Can change the length of the string.
Parameters: buffer - StringBuffer in question Parameters: i - index at which we want to change the contents Parameters: ch - replacement code point int difference in resulting StringBuffer length |
|
|