Package org.apache.abdera.i18n.text
Class CharUtils
- java.lang.Object
-
- org.apache.abdera.i18n.text.CharUtils
-
public final class CharUtils extends java.lang.ObjectGeneral utilities for dealing with Unicode characters
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCharUtils.Profile
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidappend(java.lang.Appendable buf, int c)Append the specified codepoint to the buffer, automatically handling surrogate pairsstatic voidappend(java.lang.Appendable buf, Codepoint c)Append the specified codepoint to the buffer, automatically handling surrogate pairsstatic CodepointcodepointAt(java.lang.CharSequence s, int i)Return the codepoint at the given location, automatically dealing with surrogate pairsstatic CodepointcodepointAt(java.lang.String s, int i)Return the codepoint at the given location, automatically dealing with surrogate pairsstatic intget_index(int[] set, int value)static chargetHighSurrogate(int c)Get the high surrogate for a particular unicode codepointstatic chargetLowSurrogate(int c)Get the low surrogate for a particular unicode codepointstatic booleaninRange(char[] chars, char low, char high)True if all the characters in chars are within the set [low,high]static booleaninRange(char[] chars, int low, int high)True if all the characters in chars are within the set [low,high]static booleaninRange(int codepoint, int low, int high)True if the codepoint is within the set [low,high]static voidinsert(java.lang.CharSequence s, int i, int c)Insert a codepoint into the buffer, automatically dealing with surrogate pairsstatic voidinsert(java.lang.CharSequence s, int i, Codepoint c)Insert a codepoint into the buffer, automatically dealing with surrogate pairsstatic booleaninvset_contains(int[] set, int value)Treats the specified int array as an Inversion Set and returns true if the value is located within the set.static booleanis_ifragment(int codepoint)static booleanis_ihost(int codepoint)static booleanis_ipath(int codepoint)static booleanis_ipathnodelims(int codepoint)static booleanis_ipchar(int codepoint)static booleanis_ipliteral(int codepoint)static booleanis_iprivate(int codepoint)static booleanis_iquery(int codepoint)static booleanis_iregname(int codepoint)static booleanis_iserver(int codepoint)static booleanis_iunreserved(int codepoint)static booleanis_iuserinfo(int codepoint)static booleanis_regname(int codepoint)static booleanis_ucschar(int codepoint)static booleanisAlpha(int codepoint)True if the codepoint is part of the ASCII alphabet (a-z, A-Z)static booleanisAlpha(Codepoint codepoint)True if the codepoint is part of the ASCII alphabet (a-z, A-Z)static booleanisAlphaDigit(int codepoint)True if isAlpha and isDigit both return truestatic booleanisAlphaDigit(Codepoint codepoint)True if isAlpha and isDigit both return truestatic booleanisBidi(int codepoint)True if the codepoint is a bidi control characterstatic booleanisBidi(Codepoint codepoint)True if the codepoint is a bidi control characterstatic booleanisDigit(int codepoint)True if the codepoint is a digitstatic booleanisDigit(Codepoint codepoint)True if the codepoint is a digitstatic booleanisFragment(int codepoint)static booleanisGenDelim(int codepoint)static booleanisHex(int codepoint)static booleanisHighSurrogate(char c)True if the specified char is a high surrogatestatic booleanisLowSurrogate(char c)True if the specified char is a low surrogatestatic booleanisMark(int codepoint)static booleanisPath(int codepoint)static booleanisPathNoDelims(int codepoint)static booleanisPchar(int codepoint)static booleanisPctEnc(int codepoint)static booleanisQuery(int codepoint)static booleanisReserved(int codepoint)static booleanisScheme(int codepoint)static booleanisSubDelim(int codepoint)static booleanisSupplementary(int c)True if the specified character is supplementalstatic booleanisSurrogatePair(char high, char low)True if the two chars represent a surrogate pairstatic booleanisUnreserved(int codepoint)static booleanisUserInfo(int codepoint)static booleanisValid(int c)True if the character is a valid unicode codepointstatic booleanisValid(Codepoint c)True if the character is a valid unicode codepointstatic intlength(char[] c)Return the total number of codepoints in the buffer.static intlength(int c)Return the number of characters used to represent the codepoint (will return 1 or 2)static intlength(java.lang.CharSequence c)Return the total number of codepoints in the buffer.static intlength(Codepoint c)Return the number of characters used to represent the codepoint (will return 1 or 2)static voidsetChar(java.lang.CharSequence s, int i, int c)Set the character at a given location, automatically dealing with surrogate pairsstatic voidsetChar(java.lang.CharSequence s, int i, Codepoint c)Set the character at a given location, automatically dealing with surrogate pairsstatic java.lang.StringstripBidi(java.lang.String s)Removes leading and trailing bidi controls from the stringstatic java.lang.StringstripBidiInternal(java.lang.String s)Removes bidi controls from within a stringstatic java.lang.StringtoString(int c)Return the String representation of the codepoint, automatically dealing with surrogate pairsstatic CodepointtoSupplementary(char high, char low)Converts the high and low surrogate into a supplementary codepointstatic voidverify(char[] s, CharUtils.Profile profile)Verifies a sequence of codepoints using the specified profilestatic voidverify(java.lang.String s, CharUtils.Profile profile)Verifies a sequence of codepoints using the specified profilestatic voidverify(CodepointIterator ci, CharUtils.Profile profile)Verifies a sequence of codepoints using the specified filterstatic voidverify(CodepointIterator ci, Filter filter)Verifies a sequence of codepoints using the specified filterstatic voidverifyNot(char[] array, CharUtils.Profile profile)Verifies a sequence of codepoints using the specified profilestatic voidverifyNot(CodepointIterator ci, CharUtils.Profile profile)Verifies a sequence of codepoints using the specified profilestatic voidverifyNot(CodepointIterator ci, Filter filter)Verifies a sequence of codepoints using the specified filterstatic java.lang.StringwrapBidi(java.lang.String s, char c)Wrap the string with the specified bidi control
-
-
-
Field Detail
-
LRE
public static final char LRE
- See Also:
- Constant Field Values
-
RLE
public static final char RLE
- See Also:
- Constant Field Values
-
LRO
public static final char LRO
- See Also:
- Constant Field Values
-
RLO
public static final char RLO
- See Also:
- Constant Field Values
-
LRM
public static final char LRM
- See Also:
- Constant Field Values
-
RLM
public static final char RLM
- See Also:
- Constant Field Values
-
PDF
public static final char PDF
- See Also:
- Constant Field Values
-
-
Method Detail
-
isValid
public static boolean isValid(int c)
True if the character is a valid unicode codepoint
-
isValid
public static boolean isValid(Codepoint c)
True if the character is a valid unicode codepoint
-
inRange
public static boolean inRange(char[] chars, char low, char high)True if all the characters in chars are within the set [low,high]
-
inRange
public static boolean inRange(char[] chars, int low, int high)True if all the characters in chars are within the set [low,high]
-
inRange
public static boolean inRange(int codepoint, int low, int high)True if the codepoint is within the set [low,high]
-
append
public static void append(java.lang.Appendable buf, Codepoint c)Append the specified codepoint to the buffer, automatically handling surrogate pairs
-
append
public static void append(java.lang.Appendable buf, int c)Append the specified codepoint to the buffer, automatically handling surrogate pairs
-
getHighSurrogate
public static char getHighSurrogate(int c)
Get the high surrogate for a particular unicode codepoint
-
getLowSurrogate
public static char getLowSurrogate(int c)
Get the low surrogate for a particular unicode codepoint
-
isHighSurrogate
public static boolean isHighSurrogate(char c)
True if the specified char is a high surrogate
-
isLowSurrogate
public static boolean isLowSurrogate(char c)
True if the specified char is a low surrogate
-
isSupplementary
public static boolean isSupplementary(int c)
True if the specified character is supplemental
-
isSurrogatePair
public static boolean isSurrogatePair(char high, char low)True if the two chars represent a surrogate pair
-
toSupplementary
public static Codepoint toSupplementary(char high, char low)
Converts the high and low surrogate into a supplementary codepoint
-
codepointAt
public static Codepoint codepointAt(java.lang.String s, int i)
Return the codepoint at the given location, automatically dealing with surrogate pairs
-
codepointAt
public static Codepoint codepointAt(java.lang.CharSequence s, int i)
Return the codepoint at the given location, automatically dealing with surrogate pairs
-
insert
public static void insert(java.lang.CharSequence s, int i, Codepoint c)Insert a codepoint into the buffer, automatically dealing with surrogate pairs
-
insert
public static void insert(java.lang.CharSequence s, int i, int c)Insert a codepoint into the buffer, automatically dealing with surrogate pairs
-
setChar
public static void setChar(java.lang.CharSequence s, int i, Codepoint c)Set the character at a given location, automatically dealing with surrogate pairs
-
setChar
public static void setChar(java.lang.CharSequence s, int i, int c)Set the character at a given location, automatically dealing with surrogate pairs
-
length
public static int length(Codepoint c)
Return the number of characters used to represent the codepoint (will return 1 or 2)
-
length
public static int length(int c)
Return the number of characters used to represent the codepoint (will return 1 or 2)
-
length
public static int length(java.lang.CharSequence c)
Return the total number of codepoints in the buffer. Each surrogate pair counts as a single codepoint
-
length
public static int length(char[] c)
Return the total number of codepoints in the buffer. Each surrogate pair counts as a single codepoint
-
toString
public static java.lang.String toString(int c)
Return the String representation of the codepoint, automatically dealing with surrogate pairs
-
stripBidi
public static java.lang.String stripBidi(java.lang.String s)
Removes leading and trailing bidi controls from the string
-
stripBidiInternal
public static java.lang.String stripBidiInternal(java.lang.String s)
Removes bidi controls from within a string
-
wrapBidi
public static java.lang.String wrapBidi(java.lang.String s, char c)Wrap the string with the specified bidi control
-
isDigit
public static boolean isDigit(Codepoint codepoint)
True if the codepoint is a digit
-
isDigit
public static boolean isDigit(int codepoint)
True if the codepoint is a digit
-
isAlpha
public static boolean isAlpha(Codepoint codepoint)
True if the codepoint is part of the ASCII alphabet (a-z, A-Z)
-
isAlpha
public static boolean isAlpha(int codepoint)
True if the codepoint is part of the ASCII alphabet (a-z, A-Z)
-
isAlphaDigit
public static boolean isAlphaDigit(Codepoint codepoint)
True if isAlpha and isDigit both return true
-
isAlphaDigit
public static boolean isAlphaDigit(int codepoint)
True if isAlpha and isDigit both return true
-
isHex
public static boolean isHex(int codepoint)
-
isBidi
public static boolean isBidi(Codepoint codepoint)
True if the codepoint is a bidi control character
-
isBidi
public static boolean isBidi(int codepoint)
True if the codepoint is a bidi control character
-
get_index
public static int get_index(int[] set, int value)
-
invset_contains
public static boolean invset_contains(int[] set, int value)Treats the specified int array as an Inversion Set and returns true if the value is located within the set. This will only work correctly if the values in the int array are monotonically increasing
-
isPctEnc
public static boolean isPctEnc(int codepoint)
-
isMark
public static boolean isMark(int codepoint)
-
isUnreserved
public static boolean isUnreserved(int codepoint)
-
isReserved
public static boolean isReserved(int codepoint)
-
isGenDelim
public static boolean isGenDelim(int codepoint)
-
isSubDelim
public static boolean isSubDelim(int codepoint)
-
isPchar
public static boolean isPchar(int codepoint)
-
isPath
public static boolean isPath(int codepoint)
-
isPathNoDelims
public static boolean isPathNoDelims(int codepoint)
-
isScheme
public static boolean isScheme(int codepoint)
-
isUserInfo
public static boolean isUserInfo(int codepoint)
-
isQuery
public static boolean isQuery(int codepoint)
-
isFragment
public static boolean isFragment(int codepoint)
-
is_ucschar
public static boolean is_ucschar(int codepoint)
-
is_iprivate
public static boolean is_iprivate(int codepoint)
-
is_iunreserved
public static boolean is_iunreserved(int codepoint)
-
is_ipchar
public static boolean is_ipchar(int codepoint)
-
is_ipath
public static boolean is_ipath(int codepoint)
-
is_ipathnodelims
public static boolean is_ipathnodelims(int codepoint)
-
is_iquery
public static boolean is_iquery(int codepoint)
-
is_ifragment
public static boolean is_ifragment(int codepoint)
-
is_iregname
public static boolean is_iregname(int codepoint)
-
is_ipliteral
public static boolean is_ipliteral(int codepoint)
-
is_ihost
public static boolean is_ihost(int codepoint)
-
is_regname
public static boolean is_regname(int codepoint)
-
is_iuserinfo
public static boolean is_iuserinfo(int codepoint)
-
is_iserver
public static boolean is_iserver(int codepoint)
-
verify
public static void verify(CodepointIterator ci, Filter filter) throws InvalidCharacterException
Verifies a sequence of codepoints using the specified filter- Throws:
InvalidCharacterException
-
verify
public static void verify(CodepointIterator ci, CharUtils.Profile profile) throws InvalidCharacterException
Verifies a sequence of codepoints using the specified filter- Throws:
InvalidCharacterException
-
verify
public static void verify(char[] s, CharUtils.Profile profile) throws InvalidCharacterExceptionVerifies a sequence of codepoints using the specified profile- Throws:
InvalidCharacterException
-
verify
public static void verify(java.lang.String s, CharUtils.Profile profile) throws InvalidCharacterExceptionVerifies a sequence of codepoints using the specified profile- Throws:
InvalidCharacterException
-
verifyNot
public static void verifyNot(CodepointIterator ci, Filter filter) throws InvalidCharacterException
Verifies a sequence of codepoints using the specified filter- Throws:
InvalidCharacterException
-
verifyNot
public static void verifyNot(CodepointIterator ci, CharUtils.Profile profile) throws InvalidCharacterException
Verifies a sequence of codepoints using the specified profile- Throws:
InvalidCharacterException
-
verifyNot
public static void verifyNot(char[] array, CharUtils.Profile profile) throws InvalidCharacterExceptionVerifies a sequence of codepoints using the specified profile- Throws:
InvalidCharacterException
-
-