javolution37.javolution.xml
Class CharacterData
- java.lang.Object
-
- javolution37.javolution.realtime.RealtimeObject
-
- javolution37.javolution.xml.CharacterData
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.CharSequence, Realtime
public final class CharacterData extends RealtimeObject implements java.io.Serializable, java.lang.CharSequence
This class represents a text that is not markup and constitutes the "Character Data" of a XML document.
During deserialization, instances of this class are generated for character data containing at least one non-whitespace character.
During serialization, instances of this class are written in a "CDATA" section (
).<![CDATA[...]]>
Note: During deserialization, instances of this class are wrappers around the parser characters buffer; therefore immutability is not guarantee.
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javolution37.javolution.realtime.RealtimeObject
RealtimeObject.Factory<T extends RealtimeObject>
-
Nested classes/interfaces inherited from interface javolution37.javolution.realtime.Realtime
Realtime.ObjectSpace
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description charcharAt(int index)Returns the character at the specified index.booleanequals(java.lang.Object obj)Compares this character data against the specified object for equality.char[]getChars()Returns the characters source of this character data.inthashCode()Returns the hash code for this character data.intlength()Returns the length of this character data.intoffset()Returns the index of the first character in this character data.java.lang.CharSequencesubSequence(int start, int end)Returns a subsequence of this character data.TexttoText()Returns the default textual representation of this realtime object.static CharacterDatavalueOf(char[] chars, int offset, int length)Returns the character that contains the characters from the specified subarray of characters.static CharacterDatavalueOf(java.lang.CharSequence csq)Returns the character data for the specified character sequence (convenience method).-
Methods inherited from class javolution37.javolution.realtime.RealtimeObject
export, move, moveHeap, preserve, toString, unpreserve
-
-
-
-
Method Detail
-
valueOf
public static CharacterData valueOf(char[] chars, int offset, int length)
Returns the character that contains the characters from the specified subarray of characters.- Parameters:
chars- the source of the characters.offset- the index of the first character in the data soure.length- the length of the text returned.- Returns:
- the corresponding instance.
- Throws:
java.lang.IndexOutOfBoundsException- if(offset < 0) || (length < 0) || ((offset + length) > chars.length)
-
valueOf
public static CharacterData valueOf(java.lang.CharSequence csq)
Returns the character data for the specified character sequence (convenience method).- Parameters:
csq- the character sequence being wrapped.- Returns:
- the corresponding character data instance.
-
getChars
public char[] getChars()
Returns the characters source of this character data.- Returns:
- the character array.
-
offset
public int offset()
Returns the index of the first character in this character data.- Returns:
- the first character index.
-
length
public int length()
Returns the length of this character data.- Specified by:
lengthin interfacejava.lang.CharSequence- Returns:
- the number of characters.
-
charAt
public char charAt(int index)
Returns the character at the specified index.- Specified by:
charAtin interfacejava.lang.CharSequence- Parameters:
index- the index of the character.- Returns:
- the character at the specified index.
- Throws:
java.lang.IndexOutOfBoundsException- if index is negative, or index is equal or greater thanthis.length().
-
subSequence
public java.lang.CharSequence subSequence(int start, int end)Returns a subsequence of this character data.- Specified by:
subSequencein interfacejava.lang.CharSequence- Parameters:
start- the index of the first character inclusive.end- the index of the last character exclusive.- Returns:
- a character data subsequence of this one.
- Throws:
java.lang.IndexOutOfBoundsException- if(start < 0) || (end < 0) || (start > end) || (end > this.length())
-
equals
public final boolean equals(java.lang.Object obj)
Compares this character data against the specified object for equality. Returnstrueif the specified object are both character data having the same character content.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare with ornull.- Returns:
trueif that is a character data with the same character content as this one;falseotherwise.
-
hashCode
public final int hashCode()
Returns the hash code for this character data.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash code value.
-
toText
public Text toText()
Description copied from class:RealtimeObjectReturns the default textual representation of this realtime object.- Specified by:
toTextin interfaceRealtime- Overrides:
toTextin classRealtimeObject- Returns:
- the textual representation of this object.
-
-
DMelt 3.0 © DataMelt by jWork.ORG