Package org.thymeleaf.util
Class AbstractLazyCharSequence
- java.lang.Object
-
- org.thymeleaf.util.AbstractLazyCharSequence
-
- All Implemented Interfaces:
java.lang.CharSequence,IWritableCharSequence
- Direct Known Subclasses:
LazyEscapingCharSequence,LazyProcessingCharSequence
public abstract class AbstractLazyCharSequence extends java.lang.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
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringresolvedText
-
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(java.lang.Object o)private java.lang.StringgetText()inthashCode()intlength()protected abstract java.lang.StringresolveText()java.lang.CharSequencesubSequence(int beginIndex, int endIndex)java.lang.StringtoString()voidwrite(java.io.Writer writer)Write the contents of this char sequence directly to an outputWriter.protected abstract voidwriteUnresolved(java.io.Writer writer)
-
-
-
Method Detail
-
resolveText
protected abstract java.lang.String resolveText()
-
getText
private java.lang.String getText()
-
length
public final int length()
- Specified by:
lengthin interfacejava.lang.CharSequence
-
charAt
public final char charAt(int index)
- Specified by:
charAtin interfacejava.lang.CharSequence
-
subSequence
public final java.lang.CharSequence subSequence(int beginIndex, int endIndex)- Specified by:
subSequencein interfacejava.lang.CharSequence
-
write
public final void write(java.io.Writer writer) throws java.io.IOExceptionDescription 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:
java.io.IOException- if an input/output exception happens during writing
-
writeUnresolved
protected abstract void writeUnresolved(java.io.Writer writer) throws java.io.IOException- Throws:
java.io.IOException
-
equals
public final boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public final java.lang.String toString()
- Specified by:
toStringin interfacejava.lang.CharSequence- Overrides:
toStringin classjava.lang.Object
-
-