Package net.sf.saxon.str
Class WhitespaceString
- java.lang.Object
-
- net.sf.saxon.str.UnicodeString
-
- net.sf.saxon.str.WhitespaceString
-
- All Implemented Interfaces:
java.lang.Comparable<UnicodeString>
,AtomicMatchKey
- Direct Known Subclasses:
CompressedWhitespace
,IndentWhitespace
public abstract class WhitespaceString extends UnicodeString
This abstract class represents a couple of different implementations of strings containing whitespace only.
-
-
Constructor Summary
Constructors Constructor Description WhitespaceString()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
getWidth()
Get the number of bits needed to hold all the characters in this stringlong
indexOf(int codePoint, long from)
Get the position of the first occurrence of the specified codepoint, starting the search at a given position in the stringUnicodeString
substring(long start, long end)
Returns a newUnicodeString
that is a subsequence of this sequence.java.lang.String
toString()
Returns a string representation of the object.abstract UnicodeString
uncompress()
Uncompress the whitespace to a (normal) UnicodeStringabstract void
write(UnicodeWriter writer)
Write the value to a UnicodeWriterabstract void
writeEscape(boolean[] specialChars, UnicodeWriter writer)
Write the value to a Writer with escaping of special characters-
Methods inherited from class net.sf.saxon.str.UnicodeString
asAtomic, checkSubstringBounds, codePointAt, codePoints, compareTo, concat, economize, equals, estimatedLength, hashCode, hasSubstring, indexOf, indexOf, indexWhere, isEmpty, length, length32, prefix, requireInt, substring, tidy, verifyCharacters
-
-
-
-
Method Detail
-
uncompress
public abstract UnicodeString uncompress()
Uncompress the whitespace to a (normal) UnicodeString- Returns:
- the uncompressed value
-
getWidth
public int getWidth()
Description copied from class:UnicodeString
Get the number of bits needed to hold all the characters in this string- Specified by:
getWidth
in classUnicodeString
- Returns:
- 7 for ascii characters (not used??), 8 for latin-1, 16 for BMP, 24 for general Unicode.
-
substring
public UnicodeString substring(long start, long end)
Returns a newUnicodeString
that is a subsequence of this sequence. The subsequence starts with the codepoint value at the specified index and ends with the codepoint value at index end - 1. The length (in codepoints) of thereturned sequence is end - start, so if start == end then an empty sequence is returned.- Specified by:
substring
in classUnicodeString
- Parameters:
start
- the start index, inclusiveend
- 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
-
indexOf
public long indexOf(int codePoint, long from)
Description copied from class:UnicodeString
Get the position of the first occurrence of the specified codepoint, starting the search at a given position in the string- Specified by:
indexOf
in classUnicodeString
- Parameters:
codePoint
- the sought codePointfrom
- the position from which the search should start (0-based)- Returns:
- the position (0-based) of the first occurrence found, or -1 if not found
-
toString
public java.lang.String toString()
Returns a string representation of the object.- Overrides:
toString
in classjava.lang.Object
-
write
public abstract void write(UnicodeWriter writer) throws java.io.IOException
Write the value to a UnicodeWriter- Parameters:
writer
- the writer to write to- Throws:
java.io.IOException
- if an error occurs downstream
-
writeEscape
public abstract void writeEscape(boolean[] specialChars, UnicodeWriter writer) throws java.io.IOException
Write the value to a Writer with escaping of special characters- Parameters:
specialChars
- identifies which characters are considered specialwriter
- the writer to write to- Throws:
java.io.IOException
- if an error occurs downstream
-
-