    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Interface com.jclark.xml.parse.CharacterDataEvent

public interface CharacterDataEvent

Information about character data. There is no guarantee that consecutive characters will be reported in the same `CharacterDataEvent`. Surrogate pairs are guaranteed not to be split across `CharacterDataEvent`s. Line boundaries are normalized to `'\n'` (ASCII code 10).

See Also:
  characterData

##

copyChars(char[], int)
  Copies the character data into the specified character array starting at index `off`.
getLength()
  Returns the length in chars of the character data.
getLengthMax()
  Returns an upper bound on the length of the character data.
isReference()
  Returns true if the character was a result of a character reference or a predefined entity reference.
writeChars(Writer)
  Writes the character data to the specified `Writer`.

##

getLength

     public abstract int getLength()

  Returns the length in chars of the character data. A character represented by a pair of surrogate chars counts as 2 chars.

getLengthMax

     public abstract int getLengthMax()

  Returns an upper bound on the length of the character data. The value returned is guaranteed to be greater than or equal the value returned by `getLength`. This can be used to ensure that the buffer passed to `copyChars` is large enough; it is typically much faster to use `getLengthMax` than `getLength` for this.

copyChars

     public abstract int copyChars(char cbuf[],
                                   int off)

  Copies the character data into the specified character array starting at index `off`. The length of the array must be sufficient to hold all the character data.

  Returns:
    the number of characters of data (the same as returned by `getLength`)

writeChars

     public abstract void writeChars(Writer writer) throws IOException

  Writes the character data to the specified `Writer`.

isReference

     public abstract boolean isReference()

  Returns true if the character was a result of a character reference or a predefined entity reference. If this returns true, then `getLength` and `getLengthMax` will return, unless the referenced character is represented as a surrogate pair in which case 2 will be returned.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index