Top Description Fields Methods
org.antlr.stringtemplate

public Interface StringTemplateWriter

Known Direct Implementers
org.antlr.stringtemplate.AutoIndentWriter
Imports
java.io.IOException

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

Modifier and TypeField and Description
public static final int

Method Summary

Modifier and TypeMethod and Description
public void
public String
public void
public void
public void
setLineWidth(int lineWidth)

public int
write(String str)

Write the string and return how many actual chars were written.

public int
write(String str, String wrap)

Same as write, but wrap lines using the indicated string as the wrap character (such as "\n").

public int
writeSeparator(String str)

Write a separator.

public int
writeWrapSeparator(String wrap)

Because we might need to wrap at a non-atomic string boundary (such as when we wrap in between template applications <data:{v|[) we need to expose the wrap string writing just like for the separator.

Field Detail

NO_WRAPback to summary
public static final int NO_WRAP

Method Detail

popAnchorPointback to summary
public void popAnchorPoint()
popIndentationback to summary
public String popIndentation()
pushAnchorPointback to summary
public void pushAnchorPoint()
pushIndentationback to summary
public void pushIndentation(String indent)
setLineWidthback to summary
public void setLineWidth(int lineWidth)
writeback to summary
public 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.

writeback to summary
public 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").

writeSeparatorback to summary
public int writeSeparator(String str) throws IOException

Write a separator. Same as write() except that a \n cannot be inserted before emitting a separator.

writeWrapSeparatorback to summary
public 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 ]}; wrap>) we need to expose the wrap string writing just like for the separator.