J avolution v3.7 (J2SE 1.5+)

javolution.xml
Class CharacterData

java.lang.Object
  extended by javolution.realtime.RealtimeObject
      extended by 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.

Version:
3.5, August 29, 2005
Author:
Jean-Marie Dautelle
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javolution.realtime.RealtimeObject
RealtimeObject.Factory<T extends RealtimeObject>
 
Nested classes/interfaces inherited from interface javolution.realtime.Realtime
Realtime.ObjectSpace
 
Method Summary
 char charAt(int index)
          Returns the character at the specified index.
 char[] chars()
          Returns the characters source of this character data.
 boolean equals(java.lang.Object obj)
          Compares this character data against the specified object for equality.
 int hashCode()
          Returns the hash code for this character data.
 int length()
          Returns the length of this character data.
 int offset()
          Returns the index of the first character in this character data.
 java.lang.CharSequence subSequence(int start, int end)
          Returns a subsequence of this character data.
 Text toText()
          Returns the default textual representation of this realtime object.
static CharacterData valueOf(char[] chars, int offset, int length)
          Returns the character that contains the characters from the specified subarray of characters.
static CharacterData valueOf(java.lang.CharSequence csq)
          Returns the character data for the specified character sequence (convenience method).
 
Methods inherited from class javolution.realtime.RealtimeObject
export, move, moveHeap, preserve, recycle, toString, unpreserve
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.CharSequence
toString
 

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.

chars

public char[] chars()
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:
length in interface java.lang.CharSequence
Returns:
the number of characters.

charAt

public char charAt(int index)
Returns the character at the specified index.

Specified by:
charAt in interface java.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 than this.length().

subSequence

public java.lang.CharSequence subSequence(int start,
                                          int end)
Returns a subsequence of this character data.

Specified by:
subSequence in interface java.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. Returns true if the specified object are both character data having the same character content.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with or null.
Returns:
true if that is a character data with the same character content as this one; false otherwise.

hashCode

public final int hashCode()
Returns the hash code for this character data.

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code value.

toText

public Text toText()
Description copied from class: RealtimeObject
Returns the default textual representation of this realtime object.

Specified by:
toText in interface Realtime
Overrides:
toText in class RealtimeObject
Returns:
the textual representation of this object.

J avolution v3.7 (J2SE 1.5+)

Copyright © 2006 Javolution.