org.apache.xpath.objects

Class XStringForChars

public class XStringForChars extends XString

This class will wrap a FastStringBuffer and allow for
Constructor Summary
XStringForChars(char[] val, int start, int length)
Construct a XNodeSet object.
Method Summary
voidappendToFsb(FastStringBuffer fsb)
Cast result object to a string.
charcharAt(int index)
Returns the character at the specified index.
voiddispatchAsComment(LexicalHandler lh)
Directly call the comment method on the passed LexicalHandler for the string-value.
voiddispatchCharactersEvents(ContentHandler ch)
Directly call the characters method on the passed ContentHandler for the string-value.
FastStringBufferfsb()
Cast result object to a string.
voidgetChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Copies characters from this string into the destination character array.
booleanhasString()
Tell if this object contains a java String object.
intlength()
Returns the length of this string.
Objectobject()
Since this object is incomplete without the length and the offset, we have to convert to a string when this function is called.
Stringstr()
Cast result object to a string.

Constructor Detail

XStringForChars

public XStringForChars(char[] val, int start, int length)
Construct a XNodeSet object.

Parameters: val FastStringBuffer object this will wrap, must be non-null. start The start position in the array. length The number of characters to read from the array.

Method Detail

appendToFsb

public void appendToFsb(FastStringBuffer fsb)
Cast result object to a string.

Returns: The string this wraps or the empty string if null

charAt

public char charAt(int index)
Returns the character at the specified index. An index ranges from 0 to length() - 1. The first character of the sequence is at index 0, the next at index 1, and so on, as for array indexing.

Parameters: index the index of the character.

Returns: the character at the specified index of this string. The first character is at index 0.

Throws: IndexOutOfBoundsException if the index argument is negative or not less than the length of this string.

dispatchAsComment

public void dispatchAsComment(LexicalHandler lh)
Directly call the comment method on the passed LexicalHandler for the string-value.

Parameters: lh A non-null reference to a LexicalHandler.

Throws: org.xml.sax.SAXException

dispatchCharactersEvents

public void dispatchCharactersEvents(ContentHandler ch)
Directly call the characters method on the passed ContentHandler for the string-value. Multiple calls to the ContentHandler's characters methods may well occur for a single call to this method.

Parameters: ch A non-null reference to a ContentHandler.

Throws: org.xml.sax.SAXException

fsb

public FastStringBuffer fsb()
Cast result object to a string.

Returns: The string this wraps or the empty string if null

getChars

public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
Copies characters from this string into the destination character array.

Parameters: srcBegin index of the first character in the string to copy. srcEnd index after the last character in the string to copy. dst the destination array. dstBegin the start offset in the destination array.

Throws: IndexOutOfBoundsException If any of the following is true:

NullPointerException if dst is null

hasString

public boolean hasString()
Tell if this object contains a java String object.

Returns: true if this XMLString can return a string without creating one.

length

public int length()
Returns the length of this string.

Returns: the length of the sequence of characters represented by this object.

object

public Object object()
Since this object is incomplete without the length and the offset, we have to convert to a string when this function is called.

Returns: The java String representation of this object.

str

public String str()
Cast result object to a string.

Returns: The string this wraps or the empty string if null

Copyright B) 2006 Apache XML Project. All Rights Reserved.