Interface IOutputBuffer

All Known Implementing Classes:
OutputBuffer

public interface IOutputBuffer
  • Method Details

    • chop

      void chop(int numberOfCharacters)
      Removes the specified number of characters from the end of the buffer.
    • print

      void print(Object o)
      Appends a string representation of the given object to the buffer.
    • println

      void println()
      Appends a new line the buffer.
    • println

      default void println(Object o)
      Appends a string representation of the given object and a new line to the buffer.
    • printdyn

      void printdyn(Object o)
      Appends a string representation of the given object to the buffer, correcting the indentation of the string representation to match the indentation level of the previous line in the buffer. Used to output EGL dynamic sections.
    • prinx

      default void prinx(Object o)
      An alias for print(Object) that should only be called internally, by code generated by the Preprocessor. This is a workaround to allow us to identify, in the preprocessed EOL, statements that were generated from an EGL static section. We then adjust these ASTs to allow better traceability in the AST outline view.
      See Also:
      • EglPreprocessorModule#updateRegionsOfStaticTextASTs
    • getSpaces

      default String getSpaces(int howMany)
      Returns a string comprised of the specified number of spaces.
    • setContentType

      void setContentType(String name) throws EglRuntimeException
      Specifies the type of output in the buffer, such as Java or HTML.
      Throws:
      EglRuntimeException - if the content type is not supported.
    • preserve

      default String preserve(String id, boolean enabled, String contents) throws EglRuntimeException
      Appends a protected region to the buffer.
      Parameters:
      id - - a unique identifier for this protected region
      enabled - - a flag indicating whether protection of text in this region should be enabled or not
      contents - - the contents for this protected region
      Throws:
      EglRuntimeException - if setContentType(String) has not been called.
    • preserve

      default String preserve(String startComment, String endComment, String id, boolean enabled, String contents) throws EglRuntimeException
      Appends a protected region to the buffer.
      Parameters:
      startComment - - the character sequence used to denote the start of a comment for the type of output in the buffer
      endComment - - the character sequence used to denote the end of a comment for the type of output in the buffer
      id - - a unique identifier for this protected region
      enabled - - a flag indicating whether protection of text in this region should be enabled or not
      contents - - the contents for this protected region
      Throws:
      EglRuntimeException
    • startPreserve

      String startPreserve(String id, boolean enabled) throws EglRuntimeException
      Appends the starting tag for a protected region to the buffer.
      Parameters:
      id - - a unique identifier for this protected region
      enabled - - a flag indicating whether protection of text in this region should be enabled or not
      Throws:
      EglRuntimeException - if setContentType(String) has not been called
    • startPreserve

      String startPreserve(String startComment, String endComment, String id, boolean enabled) throws EglRuntimeException
      Appends the starting tag for a protected region to the buffer.
      Parameters:
      startComment - - the character sequence used to denote the start of a comment for the type of output in the buffer
      endComment - - the character sequence used to denote the end of a comment for the type of output in the buffer
      id - - a unique identifier for this protected region
      enabled - - a flag indicating whether protection of text in this region should be enabled or not
      Throws:
      EglRuntimeException
    • stopPreserve

      String stopPreserve() throws EglRuntimeException
      Appends a closing tag for a protected region to the buffer.
      Throws:
      EglRuntimeException - if there is no unclosed protected region in the buffer.
    • control

      default String control(String id, boolean enabled, String contents) throws EglRuntimeException
      Appends a controlled region to the buffer.
      Parameters:
      id - - a unique identifier for this protected region
      enabled - - a flag indicating whether protection of text in this region should be enabled or not
      contents - - the contents for this protected region
      Throws:
      EglRuntimeException - if setContentType(String) has not been called.
    • control

      default String control(String startComment, String endComment, String id, boolean enabled, String contents) throws EglRuntimeException
      Appends a controlled region to the buffer.
      Parameters:
      startComment - - the character sequence used to denote the start of a comment for the type of output in the buffer
      endComment - - the character sequence used to denote the end of a comment for the type of output in the buffer
      id - - a unique identifier for this protected region
      enabled - - a flag indicating whether protection of text in this region should be enabled or not
      contents - - the contents for this protected region
      Throws:
      EglRuntimeException
    • startControl

      String startControl(String id, boolean enabled) throws EglRuntimeException
      Appends the starting tag for a controlled region to the buffer.
      Parameters:
      id - - a unique identifier for this protected region
      enabled - - a flag indicating whether protection of text in this region should be enabled or not
      Throws:
      EglRuntimeException - if setContentType(String) has not been called
    • startControl

      String startControl(String startComment, String endComment, String id, boolean enabled) throws EglRuntimeException
      Appends the starting tag for a protected region to the buffer.
      Parameters:
      startComment - - the character sequence used to denote the start of a comment for the type of output in the buffer
      endComment - - the character sequence used to denote the end of a comment for the type of output in the buffer
      id - - a unique identifier for this protected region
      enabled - - a flag indicating whether protection of text in this region should be enabled or not
      Throws:
      EglRuntimeException
    • stopControl

      String stopControl() throws EglRuntimeException
      Appends a closing tag for a protected region to the buffer.
      Throws:
      EglRuntimeException - if there is no unclosed protected region in the buffer.
    • stop

      void stop() throws EglStoppedException
      Halts execution of the current template.
      Throws:
      EglStoppedException
    • getCurrentLineNumber

      int getCurrentLineNumber()
      Returns the line number of the last character in the buffer.
    • getCurrentColumnNumber

      default int getCurrentColumnNumber()
      Returns the character number of the last character in the buffer.
    • getOffset

      int getOffset()
      Returns the size of the buffer.
    • formatWith

      void formatWith(Formatter formatter)
      Reformats the contents of the buffer with the given Formatter.
    • getOutdentationFormatter

      OutdentationFormatter getOutdentationFormatter()
      Returns the outdentation formatter
    • toString

      String toString()
      Converts the contents of the buffer to a string.
      Overrides:
      toString in class Object
    • getNewline

      default String getNewline()
      Returns:
      The newline character.
      Since:
      1.6
    • setIndenters

      void setIndenters(Collection<String> indentation)
    • getIndenters

      Collection<String> getIndenters()
    • getParent

      IOutputBuffer getParent()
    • setParent

      void setParent(IOutputBuffer parent)