Package org.apache.xpath.objects
Class XStringForChars
java.lang.Object
org.apache.xpath.Expression
org.apache.xpath.objects.XObject
org.apache.xpath.objects.XString
org.apache.xpath.objects.XStringForChars
- All Implemented Interfaces:
Serializable
,Cloneable
,SourceLocator
,XMLString
,ExpressionNode
,XPathVisitable
This class will wrap a FastStringBuffer and allow for
- See Also:
-
Field Summary
Fields inherited from class org.apache.xpath.objects.XString
EMPTYSTRING
Fields inherited from class org.apache.xpath.objects.XObject
CLASS_BOOLEAN, CLASS_NODESET, CLASS_NULL, CLASS_NUMBER, CLASS_RTREEFRAG, CLASS_STRING, CLASS_UNKNOWN, CLASS_UNRESOLVEDVARIABLE
-
Constructor Summary
ConstructorsConstructorDescriptionXStringForChars
(char[] val, int start, int length) Construct a XNodeSet object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Cast result object to a string.char
charAt
(int index) Returns the character at the specified index.void
Directly call the comment method on the passed LexicalHandler for the string-value.void
Directly call the characters method on the passed ContentHandler for the string-value.fsb()
Cast result object to a string.void
getChars
(int srcBegin, int srcEnd, char[] dst, int dstBegin) Copies characters from this string into the destination character array.boolean
Tell if this object contains a java String object.int
length()
Returns the length of this string.object()
Since this object is incomplete without the length and the offset, we have to convert to a string when this function is called.str()
Cast result object to a string.Methods inherited from class org.apache.xpath.objects.XString
bool, callVisitors, compareTo, compareToIgnoreCase, concat, endsWith, equals, equals, equals, equals, equalsIgnoreCase, fixWhiteSpace, getType, getTypeString, hashCode, indexOf, indexOf, indexOf, indexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, num, rtf, startsWith, startsWith, startsWith, startsWith, substring, substring, toDouble, toLowerCase, toLowerCase, toUpperCase, toUpperCase, trim, xstr
Methods inherited from class org.apache.xpath.objects.XObject
allowDetachToRelease, boolWithSideEffects, castToType, create, create, deepEquals, destruct, detach, execute, fixupVariables, getFresh, greaterThan, greaterThanOrEqual, iter, lessThan, lessThanOrEqual, mutableNodeset, nodelist, nodeset, notEquals, numWithSideEffects, reset, rtf, rtree, rtree, toString
Methods inherited from class org.apache.xpath.Expression
asIterator, asIteratorRaw, asNode, assertion, bool, canTraverseOutsideSubtree, error, execute, execute, execute, executeCharsToContentHandler, exprAddChild, exprGetChild, exprGetNumChildren, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isNodesetExpr, isStableNumber, num, warn, xstr
-
Constructor Details
-
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 Details
-
fsb
Cast result object to a string.- Returns:
- The string this wraps or the empty string if null
-
appendToFsb
Cast result object to a string.- Overrides:
appendToFsb
in classXObject
-
hasString
public boolean hasString()Tell if this object contains a java String object. -
str
Cast result object to a string. -
object
Since this object is incomplete without the length and the offset, we have to convert to a string when this function is called. -
dispatchCharactersEvents
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.- Specified by:
dispatchCharactersEvents
in interfaceXMLString
- Overrides:
dispatchCharactersEvents
in classXString
- Parameters:
ch
- A non-null reference to a ContentHandler.- Throws:
SAXException
-
dispatchAsComment
Directly call the comment method on the passed LexicalHandler for the string-value.- Specified by:
dispatchAsComment
in interfaceXMLString
- Overrides:
dispatchAsComment
in classXString
- Parameters:
lh
- A non-null reference to a LexicalHandler.- Throws:
SAXException
-
length
public int length()Returns the length of this string. -
charAt
public char charAt(int index) Returns the character at the specified index. An index ranges from0
tolength() - 1
. The first character of the sequence is at index0
, the next at index1
, and so on, as for array indexing.- Specified by:
charAt
in interfaceXMLString
- Overrides:
charAt
in classXString
- 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 theindex
argument is negative or not less than the length of this string.
-
getChars
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) Copies characters from this string into the destination character array.- Specified by:
getChars
in interfaceXMLString
- Overrides:
getChars
in classXString
- 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:srcBegin
is negative.srcBegin
is greater thansrcEnd
srcEnd
is greater than the length of this stringdstBegin
is negativedstBegin+(srcEnd-srcBegin)
is larger thandst.length
NullPointerException
- ifdst
isnull
-