Class UTF32
java.lang.Object
org.docx4j.fonts.fop.complexscripts.util.UTF32
public final class UTF32
extends java.lang.Object
UTF32 related utilities.
This work was originally authored by Glenn Adams (gadams@apache.org).
-
Method Summary
Modifier and Type Method Description static java.lang.StringfromUTF32(java.lang.Integer[] sa)Convert a Unicode scalar array (UTF-32) a Java string (UTF-16).static java.lang.Integer[]toUTF32(java.lang.String s, int substitution, boolean errorOnSubstitution)Convert Java string (UTF-16) to a Unicode scalar array (UTF-32).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
toUTF32
public static java.lang.Integer[] toUTF32(java.lang.String s, int substitution, boolean errorOnSubstitution) throws java.lang.IllegalArgumentExceptionConvert Java string (UTF-16) to a Unicode scalar array (UTF-32). Note that if there are any non-BMP encoded characters present in the input, then the number of entries in the output array will be less than the number of elements in the input string. Any- Parameters:
s- input stringsubstitution- value to substitute for ill-formed surrogateerrorOnSubstitution- throw runtime exception (IllegalArgumentException) in case this argument is true and a substitution would be attempted- Returns:
- output scalar array
- Throws:
java.lang.IllegalArgumentException- if substitution required and errorOnSubstitution is not false
-
fromUTF32
public static java.lang.String fromUTF32(java.lang.Integer[] sa) throws java.lang.IllegalArgumentExceptionConvert a Unicode scalar array (UTF-32) a Java string (UTF-16).- Parameters:
sa- input scalar array- Returns:
- output (UTF-16) string
- Throws:
java.lang.IllegalArgumentException- if an input scalar value is illegal, e.g., a surrogate or out of range
-