Class Codepoint
java.lang.Object
com.helger.commons.text.codepoint.Codepoint
- All Implemented Interfaces:
IComparable<Codepoint>,Comparable<Codepoint>
Represents a single Unicode Codepoint
- Author:
- Apache Abdera, Philip Helger
-
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a Codepoint from a byte array with the specified charset encoding.Codepoint(char cChar) Create a codepoint from a single charCodepoint(char[] aChars) Create a Codepoint from a char array.Codepoint(char cHigh, char cLow) Create a codepoint from a surrogate pairCodepoint(int nValue) Create a codepoint from a specific integer valueprotectedCodepoint(int nValue, boolean bDummyUnchecked) Special protected constructor that allows creating special codepoints that are invalid.Create a codepoint as a copy of another codepointCodepoint(CharSequence aCS) Create a Codepoint from a CharSequence.Create a Codepoint from a String. -
Method Summary
Modifier and TypeMethodDescriptionvoidappendTo(StringBuilder aSB) intbooleanbyte[]getAsBytes(Charset aCharset) char[]intfinal charfinal charfinal intgetPlane()Plane 0 (0000–FFFF): Basic Multilingual Plane (BMP).final intgetValue()inthashCode()booleanisAlpha()booleanbooleanisBidi()booleanisDigit()final booleanfinal booleanfinal booleanfinal Codepointnext()final Codepointprevious()toString()
-
Constructor Details
-
Codepoint
Create a Codepoint from a byte array with the specified charset encoding. Length must equal 1- Parameters:
aBytes- BytesaEncoding- Charset
-
Codepoint
Create a Codepoint from a CharSequence. Length must equal 1 or 2- Parameters:
aCS-CharSequence
-
Codepoint
Create a Codepoint from a String. Length must equal 1 or 2- Parameters:
sValue- String
-
Codepoint
Create a Codepoint from a char array. Length must equal 1 or 2- Parameters:
aChars- char array
-
Codepoint
public Codepoint(char cChar) Create a codepoint from a single char- Parameters:
cChar- single char
-
Codepoint
public Codepoint(char cHigh, char cLow) Create a codepoint from a surrogate pair- Parameters:
cHigh- high surrogatecLow- low surrogate
-
Codepoint
Create a codepoint as a copy of another codepoint- Parameters:
aCodepoint- Object to copy
-
Codepoint
Create a codepoint from a specific integer value- Parameters:
nValue- int value
-
Codepoint
Special protected constructor that allows creating special codepoints that are invalid.- Parameters:
nValue- The codepoint value to be used. Must not be a valid codepoint.bDummyUnchecked- Dummy parameter to create a different signature
-
-
Method Details
-
getValue
- Returns:
- The codepoint value
-
isSupplementary
public final boolean isSupplementary()- Returns:
trueif this codepoint is supplementary (> 0xffff)
-
isLowSurrogate
public final boolean isLowSurrogate()- Returns:
trueif this codepoint is a low surrogate
-
isHighSurrogate
public final boolean isHighSurrogate()- Returns:
trueif this codepoint is a high surrogate
-
getHighSurrogate
public final char getHighSurrogate()- Returns:
- Get the high surrogate of this Codepoint
-
getLowSurrogate
public final char getLowSurrogate()- Returns:
- Get the low surrogate of this Codepoint
-
isBidi
public boolean isBidi()- Returns:
trueif this Codepoint is a bidi control char
-
isDigit
public boolean isDigit() -
isAlpha
public boolean isAlpha() -
isAlphaDigit
public boolean isAlphaDigit() -
getAsString
-
getAsChars
-
getCharCount
- Returns:
- The number of chars necessary to represent this codepoint. Returns 2 if this is a supplementary codepoint, 1 otherwise.
-
getAsBytes
-
getPlane
public final int getPlane()Plane 0 (0000–FFFF): Basic Multilingual Plane (BMP). This is the plane containing most of the character assignments so far. A primary objective for the BMP is to support the unification of prior character sets as well as characters for writing systems in current use.
Plane 1 (10000–1FFFF): Supplementary Multilingual Plane (SMP).
Plane 2 (20000–2FFFF): Supplementary Ideographic Plane (SIP)
Planes 3 to 13 (30000–DFFFF) are unassigned
Plane 14 (E0000–EFFFF): Supplementary Special-purpose Plane (SSP)
Plane 15 (F0000–FFFFF) reserved for the Private Use Area (PUA)
Plane 16 (100000–10FFFF), reserved for the Private Use Area (PUA)- Returns:
- Plane number
-
next
- Returns:
- Get the next codepoint
-
previous
- Returns:
- Get the previous codepoint
-
appendTo
-
compareTo
- Specified by:
compareToin interfaceComparable<Codepoint>
-
equals
-
hashCode
public int hashCode() -
toString
-