org.apache.abdera.i18n.text
Class Codepoint

java.lang.Object
  extended by org.apache.abdera.i18n.text.Codepoint
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Codepoint>

public class Codepoint
extends Object
implements Serializable, Cloneable, Comparable<Codepoint>

Represents a single Unicode Codepoint

See Also:
Serialized Form

Constructor Summary
Codepoint(byte[] bytes)
          Create a Codepoint from a byte array using the default encoding (UTF-8)
Codepoint(byte[] bytes, String encoding)
          Create a Codepoint from a byte array with the specified charset encoding.
Codepoint(char value)
          Create a codepoint from a single char
Codepoint(char high, char low)
          Create a codepoint from a surrogate pair
Codepoint(CharSequence value)
          Create a Codepoint from a CharSequence.
Codepoint(Codepoint codepoint)
          Create a codepoint as a copy of another codepoint
Codepoint(int value)
          Create a codepoint from a specific integer value
 
Method Summary
 Codepoint clone()
           
 int compareTo(Codepoint o)
           
 boolean equals(Object obj)
           
 int getCharCount()
          Get the number of chars necessary to represent this codepoint.
 char getHighSurrogate()
          Get the high surrogate of this Codepoint
 char getLowSurrogate()
          Get the low surrogate of this Codepoint
 int getPlane()
          Plane 0 (0000–FFFF): Basic Multilingual Plane (BMP).
 int getValue()
          The codepoint value
 int hashCode()
           
 boolean isAlpha()
           
 boolean isAlphaDigit()
           
 boolean isBidi()
          True if this Codepoint is a bidi control char
 boolean isDigit()
           
 boolean isHighSurrogate()
          True if this codepoint is a high surrogate
 boolean isLowSurrogate()
          True if this codepoint is a low surrogate
 boolean isSupplementary()
          True if this codepoint is supplementary
 Codepoint next()
          Get the next codepoint
 Codepoint previous()
          Get the previous codepoint
 byte[] toBytes()
           
 byte[] toBytes(String encoding)
           
 char[] toChars()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Codepoint

public Codepoint(byte[] bytes)
Create a Codepoint from a byte array using the default encoding (UTF-8)


Codepoint

public Codepoint(byte[] bytes,
                 String encoding)
          throws UnsupportedEncodingException
Create a Codepoint from a byte array with the specified charset encoding. Length must equal 1

Throws:
UnsupportedEncodingException

Codepoint

public Codepoint(CharSequence value)
Create a Codepoint from a CharSequence. Length must equal 1


Codepoint

public Codepoint(char value)
Create a codepoint from a single char


Codepoint

public Codepoint(char high,
                 char low)
Create a codepoint from a surrogate pair


Codepoint

public Codepoint(Codepoint codepoint)
Create a codepoint as a copy of another codepoint


Codepoint

public Codepoint(int value)
Create a codepoint from a specific integer value

Method Detail

getValue

public int getValue()
The codepoint value


isSupplementary

public boolean isSupplementary()
True if this codepoint is supplementary


isLowSurrogate

public boolean isLowSurrogate()
True if this codepoint is a low surrogate


isHighSurrogate

public boolean isHighSurrogate()
True if this codepoint is a high surrogate


getHighSurrogate

public char getHighSurrogate()
Get the high surrogate of this Codepoint


getLowSurrogate

public char getLowSurrogate()
Get the low surrogate of this Codepoint


isBidi

public boolean isBidi()
True if this Codepoint is a bidi control char


isDigit

public boolean isDigit()

isAlpha

public boolean isAlpha()

isAlphaDigit

public boolean isAlphaDigit()

compareTo

public int compareTo(Codepoint o)
Specified by:
compareTo in interface Comparable<Codepoint>

toString

public String toString()
Overrides:
toString in class Object

toChars

public char[] toChars()

getCharCount

public int getCharCount()
Get the number of chars necessary to represent this codepoint. Returns 2 if this is a supplementary codepoint


toBytes

public byte[] toBytes()

toBytes

public byte[] toBytes(String encoding)
               throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getPlane

public 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)


clone

public Codepoint clone()
Overrides:
clone in class Object

next

public Codepoint next()
Get the next codepoint


previous

public Codepoint previous()
Get the previous codepoint



Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.