|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.tinytree.LargeStringBuffer
This is an implementation of the JDK 1.4 CharSequence interface: it implements a CharSequence as a list of arrays of characters (the individual arrays are known as segments). When characters are appended, a new segment is started if the previous array would otherwise overflow a threshold size (the maxAllocation size).
This is more efficient than a buffer backed by a contiguous array of characters in cases where the size is likely to grow very large, and where substring operations are rare. As used within the TinyTree, the value of each text node is contiguous within one segment, so extraction of the value of a text node is efficient.
Constructor Summary | |
LargeStringBuffer()
Create an empty LargeStringBuffer with default space allocation |
|
LargeStringBuffer(int minAllocation,
int maxAllocation)
Create an empty LargeStringBuffer |
Method Summary | |
void |
append(java.lang.CharSequence data)
Append a CharSequence to this LargeStringBuffer |
char |
charAt(int index)
Returns the character at the specified index. |
boolean |
equals(java.lang.Object other)
Compare equality |
int |
hashCode()
Generate a hash code |
int |
length()
Returns the length of this character sequence. |
java.lang.CharSequence |
subSequence(int start,
int end)
Returns a new character sequence that is a subsequence of this sequence. |
java.lang.String |
substring(int start,
int end)
Returns a new character sequence that is a subsequence of this sequence. |
java.lang.String |
toString()
Convert to a string |
void |
write(java.io.Writer writer)
Write the value to a writer |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public LargeStringBuffer()
public LargeStringBuffer(int minAllocation, int maxAllocation)
minAllocation
- initial allocation size for each segment (including the first)maxAllocation
- maximum allocation size for each segment. When a segment reaches this
size, a new segment is created rather than appending more characters to the existing segment.Method Detail |
public void append(java.lang.CharSequence data)
public int length()
length
in interface java.lang.CharSequence
public char charAt(int index)
charAt
in interface java.lang.CharSequence
index
- the index of the character to be returned
java.lang.IndexOutOfBoundsException
- if the index argument is negative or not less than
length()public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
start
- the start index, inclusiveend
- the end index, exclusive
java.lang.IndexOutOfBoundsException
- if start or end are negative,
if end is greater than length(),
or if start is greater than endpublic java.lang.String toString()
toString
in interface java.lang.CharSequence
public boolean equals(java.lang.Object other)
public int hashCode()
public java.lang.String substring(int start, int end)
public void write(java.io.Writer writer) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |