public class IndentWhitespace extends WhitespaceString
CompressedWhitespace class, and is specifically used for constructing indentation and passing
it to a UTF8Writer, which recognizes it specially. Unlike CompressedWhitespace, it can't
handle arbitrary whitespace strings, only those consisting of newlines followed by spaces.| Modifier and Type | Method and Description |
|---|---|
int |
codePointAt(long index)
Returns the codepoint value at the specified index.
|
IntIterator |
codePoints()
Get an iterator over the code points present in the string.
|
int |
getNewlines()
Get the number of newlines at the start
|
int |
getSpaces()
Get the number of spaces following the newlines
|
long |
length()
Get the length of the string
|
int |
length32()
Get the length of the string, provided it is less than 2^31 characters
|
static IndentWhitespace |
of(int newlines,
int spaces)
Create an IndentWhitespace object
|
java.lang.String |
toString()
Returns a string representation of the object.
|
UnicodeString |
uncompress()
Uncompress the whitespace to a (normal) UnicodeString
|
void |
write(UnicodeWriter writer)
Write the value to a UnicodeWriter
|
void |
writeEscape(boolean[] specialChars,
UnicodeWriter writer)
Write the value to a Writer with escaping of special characters
|
getWidth, indexOf, substringasAtomic, checkSubstringBounds, compareTo, concat, economize, equals, estimatedLength, hashCode, hasSubstring, indexOf, indexOf, indexWhere, isEmpty, prefix, requireInt, substring, tidy, verifyCharacterspublic static IndentWhitespace of(int newlines, int spaces)
newlines - the number of newlines at the startspaces - the number of spaces following the newlinespublic UnicodeString uncompress()
uncompress in class WhitespaceStringpublic long length()
UnicodeStringlength in class UnicodeStringpublic int length32()
UnicodeStringlength32 in class UnicodeStringintpublic int getNewlines()
public int getSpaces()
public int codePointAt(long index)
codePointAt in class UnicodeStringindex - the index of the codepoint value to be returnedjava.lang.IndexOutOfBoundsException - if the index argument is negative or not less than
length()public IntIterator codePoints()
UnicodeStringcodePoints in class UnicodeStringpublic java.lang.String toString()
toString in class WhitespaceStringpublic void write(UnicodeWriter writer) throws java.io.IOException
write in class WhitespaceStringwriter - the writer to write tojava.io.IOException - if an error occurs downstreampublic void writeEscape(boolean[] specialChars,
UnicodeWriter writer)
throws java.io.IOException
writeEscape in class WhitespaceStringspecialChars - identifies which characters are considered specialwriter - the writer to write tojava.io.IOException - if an error occurs downstreamCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.