Interface StringTemplateWriter

All Known Implementing Classes:
AutoIndentWriter, NoIndentWriter

public interface StringTemplateWriter
Generic StringTemplate output writer filter. Literals and the elements of expressions are emitted via write(). Separators are emitted via writeSeparator() because they must be handled specially when wrapping lines (we don't want to wrap in between an element and it's separator).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
     
    void
     
    void
     
    void
    setLineWidth(int lineWidth)
     
    int
    Write the string and return how many actual chars were written.
    int
    write(String str, String wrap)
    Same as write, but wrap lines using the indicated string as the wrap character (such as "\n").
    int
    Write a separator.
    int
    Because we might need to wrap at a non-atomic string boundary (such as when we wrap in between template applications invalid input: '<'data:{v|[]}; wrap>) we need to expose the wrap string writing just like for the separator.
  • Field Details

  • Method Details

    • pushIndentation

      void pushIndentation(String indent)
    • popIndentation

      String popIndentation()
    • pushAnchorPoint

      void pushAnchorPoint()
    • popAnchorPoint

      void popAnchorPoint()
    • setLineWidth

      void setLineWidth(int lineWidth)
    • write

      int write(String str) throws IOException
      Write the string and return how many actual chars were written. With autoindentation and wrapping, more chars than length(str) can be emitted. No wrapping is done.
      Throws:
      IOException
    • write

      int write(String str, String wrap) throws IOException
      Same as write, but wrap lines using the indicated string as the wrap character (such as "\n").
      Throws:
      IOException
    • writeWrapSeparator

      int writeWrapSeparator(String wrap) throws IOException
      Because we might need to wrap at a non-atomic string boundary (such as when we wrap in between template applications invalid input: '<'data:{v|[]}; wrap>) we need to expose the wrap string writing just like for the separator.
      Throws:
      IOException
    • writeSeparator

      int writeSeparator(String str) throws IOException
      Write a separator. Same as write() except that a \n cannot be inserted before emitting a separator.
      Throws:
      IOException