Class AbstractLazyCharSequence

  • All Implemented Interfaces:
    , IWritableCharSequence
    Direct Known Subclasses:
    LazyEscapingCharSequence, LazyProcessingCharSequence

    public abstract class AbstractLazyCharSequence
    extends 
    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 Detail

      • AbstractLazyCharSequence

        protected AbstractLazyCharSequence()
    • Method Detail

      • resolveText

        protected abstract  resolveText()
      • length

        public final int length()
        Specified by:
         in interface 
      • charAt

        public final char charAt​(int index)
        Specified by:
         in interface 
      • subSequence

        public final  subSequence​(int beginIndex,
                                              int endIndex)
        Specified by:
         in interface 
      • write

        public final void write​( writer)
                         throws 
        Description copied from interface: IWritableCharSequence

        Write the contents of this char sequence directly to an output .

        This method can avoid the need to create a object containing all the contents in this character sequence just when we want to write it to a .

        Specified by:
        write in interface IWritableCharSequence
        Parameters:
        writer - the writer to write the character sequence to.
        Throws:
        - if an input/output exception happens during writing
      • writeUnresolved

        protected abstract void writeUnresolved​( writer)
                                         throws 
        Throws:
      • equals

        public final boolean equals​( o)
        Overrides:
         in class 
      • hashCode

        public final int hashCode()
        Overrides:
         in class 
      • toString

        public final  toString()
        Specified by:
         in interface 
        Overrides:
         in class