public final class Normalizer
extends java.lang.Object
Utility for the normalization of Unicode Strings to NFC form.
This class tries to use the java.text.Normalizer class in JDK 1.6 first and, if it the class is not found (Java version < 6), then it will use the ICU4J com.ibm.icu.text.Normalizer class (in this case, a ClassNotFoundException will be thrown if ICU4J is not present).
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
ICU_NORMALIZER_CLASS_NAME |
private static java.lang.Object |
javaTextNormalizerFormNFCConstant |
private static java.lang.reflect.Method |
javaTextNormalizerMethod |
private static java.lang.String |
JDK_NORMALIZER_CLASS_NAME |
private static java.lang.String |
JDK_NORMALIZER_FORM_CLASS_NAME |
private static java.lang.Boolean |
useIcuNormalizer |
| Modifier | Constructor and Description |
|---|---|
private |
Normalizer() |
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
initializeIcu4j() |
(package private) static void |
initializeJavaTextNormalizer() |
static char[] |
normalizeToNfc(char[] message)
Normalize Unicode-input message to NFC.
|
static java.lang.String |
normalizeToNfc(java.lang.String message)
Normalize Unicode-input message to NFC.
|
(package private) static char[] |
normalizeWithIcu4j(char[] message) |
(package private) static char[] |
normalizeWithJavaNormalizer(char[] message) |
private static final java.lang.String ICU_NORMALIZER_CLASS_NAME
private static final java.lang.String JDK_NORMALIZER_CLASS_NAME
private static final java.lang.String JDK_NORMALIZER_FORM_CLASS_NAME
private static java.lang.Boolean useIcuNormalizer
private static java.lang.reflect.Method javaTextNormalizerMethod
private static java.lang.Object javaTextNormalizerFormNFCConstant
public static java.lang.String normalizeToNfc(java.lang.String message)
Normalize Unicode-input message to NFC.
This algorithm will first try to normalize the input's UNICODE using icu4j's com.ibm.icu.text.Normalizer and, if it is not present at the classpath, will try to use java.text.Normalizer. If this is not present either (this class appeared in JavaSE 6), it will raise an exception.
message - the message to be normalizedpublic static char[] normalizeToNfc(char[] message)
Normalize Unicode-input message to NFC.
This algorithm will first try to normalize the input's UNICODE using icu4j's com.ibm.icu.text.Normalizer and, if it is not present at the classpath, will try to use java.text.Normalizer. If this is not present either (this class appeared in JavaSE 6), it will raise an exception.
message - the message to be normalizedstatic void initializeIcu4j()
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionstatic void initializeJavaTextNormalizer()
throws java.lang.ClassNotFoundException,
java.lang.NoSuchMethodException,
java.lang.NoSuchFieldException,
java.lang.IllegalAccessException
java.lang.ClassNotFoundExceptionjava.lang.NoSuchMethodExceptionjava.lang.NoSuchFieldExceptionjava.lang.IllegalAccessExceptionstatic char[] normalizeWithJavaNormalizer(char[] message)
static char[] normalizeWithIcu4j(char[] message)