Package org.thymeleaf.util
Class AbstractLazyCharSequence
- Object
-
- org.thymeleaf.util.AbstractLazyCharSequence
-
- All Implemented Interfaces:
CharSequence,IWritableCharSequence
- Direct Known Subclasses:
LazyEscapingCharSequence,LazyProcessingCharSequence
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.
- Since:
- 3.0.0
- Author:
- Daniel Fernández
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractLazyCharSequence()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description charcharAt(int index)booleanequals(Object o)inthashCode()intlength()protected abstract StringresolveText()CharSequencesubSequence(int beginIndex, int endIndex)StringtoString()voidwrite(Writer writer)Write the contents of this char sequence directly to an outputWriter.protected abstract voidwriteUnresolved(Writer writer)
-
-
-
Method Detail
-
resolveText
protected abstract String resolveText()
-
length
public final int length()
- Specified by:
lengthin interfaceCharSequence
-
charAt
public final char charAt(int index)
- Specified by:
charAtin interfaceCharSequence
-
subSequence
public final CharSequence subSequence(int beginIndex, int endIndex)
- Specified by:
subSequencein interfaceCharSequence
-
write
public final void write(Writer writer) throws IOException
Description copied from interface:IWritableCharSequenceWrite the contents of this char sequence directly to an output
Writer.This method can avoid the need to create a
Stringobject containing all the contents in this character sequence just when we want to write it to aWriter.- Specified by:
writein interfaceIWritableCharSequence- Parameters:
writer- the writer to write the character sequence to.- Throws:
IOException- if an input/output exception happens during writing
-
writeUnresolved
protected abstract void writeUnresolved(Writer writer) throws IOException
- Throws:
IOException
-
toString
public final String toString()
- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-
-