Interface IOutputBuffer

  • All Known Implementing Classes:
    OutputBuffer

    public interface IOutputBuffer
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void chop​(int numberOfCharacters)
      Removes the specified number of characters from the end of the buffer.
      default java.lang.String control​(java.lang.String id, boolean enabled, java.lang.String contents)
      Appends a controlled region to the buffer.
      default java.lang.String control​(java.lang.String startComment, java.lang.String endComment, java.lang.String id, boolean enabled, java.lang.String contents)
      Appends a controlled region to the buffer.
      void formatWith​(Formatter formatter)
      Reformats the contents of the buffer with the given Formatter.
      default int getCurrentColumnNumber()
      Returns the character number of the last character in the buffer.
      int getCurrentLineNumber()
      Returns the line number of the last character in the buffer.
      default java.lang.String getNewline()  
      int getOffset()
      Returns the size of the buffer.
      default java.lang.String getSpaces​(int howMany)
      Returns a string comprised of the specificed number of spaces.
      default java.lang.String preserve​(java.lang.String id, boolean enabled, java.lang.String contents)
      Appends a protected region to the buffer.
      default java.lang.String preserve​(java.lang.String startComment, java.lang.String endComment, java.lang.String id, boolean enabled, java.lang.String contents)
      Appends a protected region to the buffer.
      void print​(java.lang.Object o)
      Appends a string representation of the given object to the buffer.
      void printdyn​(java.lang.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.
      void println()
      Appends a new line the buffer.
      default void println​(java.lang.Object o)
      Appends a string representation of the given object and a new line to the buffer.
      default void prinx​(java.lang.Object o)
      An alias for print(Object) that should only be called internally, by code generated by the Preprocessor.
      void setContentType​(java.lang.String name)
      Specifies the type of output in the buffer, such as Java or HTML.
      java.lang.String startControl​(java.lang.String id, boolean enabled)
      Appends the starting tag for a controlled region to the buffer.
      java.lang.String startControl​(java.lang.String startComment, java.lang.String endComment, java.lang.String id, boolean enabled)
      Appends the starting tag for a protected region to the buffer.
      java.lang.String startPreserve​(java.lang.String id, boolean enabled)
      Appends the starting tag for a protected region to the buffer.
      java.lang.String startPreserve​(java.lang.String startComment, java.lang.String endComment, java.lang.String id, boolean enabled)
      Appends the starting tag for a protected region to the buffer.
      void stop()
      Halts execution of the current template.
      java.lang.String stopControl()
      Appends a closing tag for a protected region to the buffer.
      java.lang.String stopPreserve()
      Appends a closing tag for a protected region to the buffer.
      java.lang.String toString()
      Converts the contents of the buffer to a string.
    • Method Detail

      • chop

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

        void print​(java.lang.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​(java.lang.Object o)
        Appends a string representation of the given object and a new line to the buffer.
      • printdyn

        void printdyn​(java.lang.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​(java.lang.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 java.lang.String getSpaces​(int howMany)
        Returns a string comprised of the specificed number of spaces.
      • setContentType

        void setContentType​(java.lang.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 java.lang.String preserve​(java.lang.String id,
                                          boolean enabled,
                                          java.lang.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 java.lang.String preserve​(java.lang.String startComment,
                                          java.lang.String endComment,
                                          java.lang.String id,
                                          boolean enabled,
                                          java.lang.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

        java.lang.String startPreserve​(java.lang.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

        java.lang.String startPreserve​(java.lang.String startComment,
                                       java.lang.String endComment,
                                       java.lang.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

        java.lang.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 java.lang.String control​(java.lang.String id,
                                         boolean enabled,
                                         java.lang.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 java.lang.String control​(java.lang.String startComment,
                                         java.lang.String endComment,
                                         java.lang.String id,
                                         boolean enabled,
                                         java.lang.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

        java.lang.String startControl​(java.lang.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

        java.lang.String startControl​(java.lang.String startComment,
                                      java.lang.String endComment,
                                      java.lang.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

        java.lang.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.
      • 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.
      • toString

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

        default java.lang.String getNewline()
        Returns:
        The newline character.
        Since:
        1.6