public abstract class AbstractLazyCharSequence extends Object implements IWritableCharSequence
Abstract class for character sequences that perform lazy evaluation of their textual contents.
Implementations of this class allow the possibility that their textual contents are actually computed during output writing (if possible), and therefore directly written to output buffers and never requiring being completely resolved in memory.
This is mostly an internal class, and its use is not recommended from user's code.
Children of this class are not thread-safe.
Modifier | Constructor and Description |
---|---|
protected |
AbstractLazyCharSequence() |
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index) |
boolean |
equals(Object o) |
int |
hashCode() |
int |
length() |
protected abstract String |
resolveText() |
CharSequence |
subSequence(int beginIndex,
int endIndex) |
String |
toString() |
void |
write(Writer writer)
Write the contents of this char sequence directly to an output
Writer . |
protected abstract void |
writeUnresolved(Writer writer) |
chars, codePoints
protected abstract String resolveText()
public final int length()
length
in interface CharSequence
public final char charAt(int index)
charAt
in interface CharSequence
public final CharSequence subSequence(int beginIndex, int endIndex)
subSequence
in interface CharSequence
public final void write(Writer writer) throws IOException
IWritableCharSequence
Write the contents of this char sequence directly to an output Writer
.
This method can avoid the need to create a String
object containing all the contents in
this character sequence just when we want to write it to a Writer
.
write
in interface IWritableCharSequence
writer
- the writer to write the character sequence to.IOException
- if an input/output exception happens during writingprotected abstract void writeUnresolved(Writer writer) throws IOException
IOException
public final String toString()
toString
in interface CharSequence
toString
in class Object
Copyright © 2016 The THYMELEAF team. All rights reserved.