public class CompressedWhitespace
extends java.lang.Object
implements java.lang.CharSequence
Constructor and Description |
---|
CompressedWhitespace(long compressedValue) |
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index)
Returns the
char value at the specified index. |
static java.lang.CharSequence |
compress(java.lang.CharSequence in)
Attempt to compress a CharSequence
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
long |
getCompressedValue() |
int |
hashCode()
Returns a hash code value for the object.
|
int |
length() |
java.lang.CharSequence |
subSequence(int start,
int end)
Returns a new
CharSequence that is a subsequence of this sequence. |
java.lang.String |
toString()
Returns a string representation of the object.
|
FastStringBuffer |
uncompress(FastStringBuffer buffer)
Uncompress the whitespace to a FastStringBuffer
|
static void |
uncompress(long value,
FastStringBuffer buffer) |
void |
write(java.io.Writer writer)
Write the value to a Writer
|
void |
writeEscape(boolean[] specialChars,
java.io.OutputStream stream)
Write the value to a UTF-8 OutputStream with escaping of special characters
|
void |
writeEscape(boolean[] specialChars,
java.io.Writer writer)
Write the value to a Writer with escaping of special characters
|
public static java.lang.CharSequence compress(java.lang.CharSequence in)
in
- the CharSequence to be compressedpublic FastStringBuffer uncompress(FastStringBuffer buffer)
buffer
- the buffer to which the whitespace is to be appended. The parameter may be
null, in which case a new buffer is created.public static void uncompress(long value, FastStringBuffer buffer)
public long getCompressedValue()
public int length()
length
in interface java.lang.CharSequence
public char charAt(int index)
char
value at the specified index. An index ranges from zero
to length() - 1. The first char
value of the sequence is at
index zero, the next at index one, and so on, as for array
indexing.
If the char
value specified by the index is a
surrogate, the surrogate
value is returned.
charAt
in interface java.lang.CharSequence
index
- the index of the char
value to be returnedchar
valuejava.lang.IndexOutOfBoundsException
- if the index argument is negative or not less than
length()public java.lang.CharSequence subSequence(int start, int end)
CharSequence
that is a subsequence of this sequence.
The subsequence starts with the char
value at the specified index and
ends with the char
value at index end - 1. The length
(in char
s) of the
returned sequence is end - start, so if start == end
then an empty sequence is returned. subSequence
in interface java.lang.CharSequence
start
- the start index, inclusiveend
- the end index, exclusivejava.lang.IndexOutOfBoundsException
- if start or end are negative,
if end is greater than length(),
or if start is greater than endpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Object
public void write(java.io.Writer writer) throws java.io.IOException
writer
- the writer to write tojava.io.IOException
- if an error occurs downstreampublic void writeEscape(boolean[] specialChars, java.io.Writer writer) throws java.io.IOException
specialChars
- identifies which characters are considered specialwriter
- the writer to write tojava.io.IOException
- if an error occurs downstreampublic void writeEscape(boolean[] specialChars, java.io.OutputStream stream) throws java.io.IOException
specialChars
- array of booleans indicating which characters need to be XML-escapedstream
- the output stream to write tojava.io.IOException
- if an error occurs downstreamCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.