Package net.sf.saxon.tree.tiny
Class LargeStringBuffer
- java.lang.Object
- 
- net.sf.saxon.tree.tiny.LargeStringBuffer
 
- 
- All Implemented Interfaces:
- java.lang.CharSequence,- AppendableCharSequence
 
 public final class LargeStringBuffer extends java.lang.Object implements AppendableCharSequence This is an implementation of the CharSequence interface: it implements a CharSequence as a list of arrays of characters (the individual arrays are known as segments). The segments have a fixed size of 65536 characters.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, extraction of the string value of a node requires character copying only in the case where the value crosses segment boundaries. 
- 
- 
Constructor SummaryConstructors Constructor Description LargeStringBuffer()Create an empty LargeStringBuffer with default space allocation
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description LargeStringBuffercat(char c)Append a single character to this CharSequenceLargeStringBuffercat(java.lang.CharSequence s)Append a CharSequence to this LargeStringBuffercharcharAt(int index)Returns the character at the specified index.booleanequals(java.lang.Object other)Compare equalityinthashCode()Generate a hash codeintlength()Returns the length of this character sequence.voidsetLength(int length)Set the length.java.lang.CharSequencesubSequence(int start, int end)Returns a new character sequence that is a subsequence of this sequence.java.lang.Stringsubstring(int start, int end)Returns a new character sequence that is a subsequence of this sequence.java.lang.StringtoString()Convert to a stringvoidwrite(java.io.Writer writer)Write the value to a writer
 
- 
- 
- 
Method Detail- 
catpublic LargeStringBuffer cat(java.lang.CharSequence s) Append a CharSequence to this LargeStringBuffer- Specified by:
- catin interface- AppendableCharSequence
- Parameters:
- s- the data to be appended
- Returns:
- the concatenated results
 
 - 
catpublic LargeStringBuffer cat(char c) Description copied from interface:AppendableCharSequenceAppend a single character to this CharSequence- Specified by:
- catin interface- AppendableCharSequence
- Parameters:
- c- the character to be appended
- Returns:
- the concatenated results
 
 - 
lengthpublic int length() Returns the length of this character sequence. The length is the number of 16-bit UTF-16 characters in the sequence.- Specified by:
- lengthin interface- java.lang.CharSequence
- Returns:
- the number of characters in this sequence
 
 - 
setLengthpublic void setLength(int length) Set the length. If this exceeds the current length, this method is a no-op. If this is less than the current length, characters beyond the specified point are deleted.- Specified by:
- setLengthin interface- AppendableCharSequence
- Parameters:
- length- the new length
 
 - 
charAtpublic char charAt(int index) Returns the character at the specified index. An index ranges from zero to length() - 1. The first character of the sequence is at index zero, the next at index one, and so on, as for array indexing.- Specified by:
- charAtin interface- java.lang.CharSequence
- Parameters:
- index- the index of the character to be returned
- Returns:
- the specified character
- Throws:
- java.lang.IndexOutOfBoundsException- if the index argument is negative or not less than length()
 
 - 
subSequencepublic java.lang.CharSequence subSequence(int start, int end)Returns a new character sequence that is a subsequence of this sequence. The subsequence starts with the character at the specified index and ends with the character at index end - 1. The length of the returned sequence is end - start, so if start == end then an empty sequence is returned.- Specified by:
- subSequencein interface- java.lang.CharSequence
- Parameters:
- start- the start index, inclusive
- end- the end index, exclusive
- Returns:
- the specified subsequence
- Throws:
- java.lang.IndexOutOfBoundsException- if start or end are negative, if end is greater than length(), or if start is greater than end
 
 - 
toStringpublic java.lang.String toString() Convert to a string- Specified by:
- toStringin interface- java.lang.CharSequence
- Overrides:
- toStringin class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object other) Compare equality- Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() Generate a hash code- Overrides:
- hashCodein class- java.lang.Object
 
 - 
substringpublic java.lang.String substring(int start, int end)Returns a new character sequence that is a subsequence of this sequence. Unlike subSequence, this is guaranteed to return a String.- Parameters:
- start- index of the first character to be included
- end- index of the character after the last one to be included
- Returns:
- the substring at the given position
 
 - 
writepublic void write(java.io.Writer writer) throws java.io.IOExceptionWrite the value to a writer- Parameters:
- writer- the writer to which the value is to be written
- Throws:
- java.io.IOException- if an error occurs downstream
 
 
- 
 
-