public class SourcePrinter extends Object
Modifier and Type | Method and Description |
---|---|
Position |
getCursor()
Return the current cursor position (line, column) in the source printer buffer.
|
String |
getSource() |
SourcePrinter |
indent() |
String |
normalizeEolInTextBlock(String content) |
SourcePrinter |
print(String arg)
Append the source string passed as argument to the buffer.
|
SourcePrinter |
println()
Append a newline to the buffer.
|
SourcePrinter |
println(String arg)
Append the source string passed as argument to the buffer, then append a newline.
|
String |
toString() |
SourcePrinter |
unindent() |
void |
wrapToColumn(int column)
Performs a new line and indent, then prints enough space characters until aligned to the specified column.
|
public SourcePrinter indent()
public SourcePrinter unindent()
public SourcePrinter print(String arg)
The source line to be printed should not contain newline/carriage-return characters;
use println(String)
to automatically append a newline at the end of the source string.
If the source line passed as argument contains newline/carriage-return characters would
impredictably affect a correct computation of the current getCursor()
position.
arg
- source line to be printed (should not contain newline/carriage-return characters)println(String)
public SourcePrinter println(String arg)
The source line to be printed should not contain newline/carriage-return characters.
If the source line passed as argument contains newline/carriage-return characters would
impredictably affect a correct computation of the current getCursor()
position.
arg
- source line to be printed (should not contain newline/carriage-return characters)public SourcePrinter println()
public Position getCursor()
Please notice in order to guarantee a correct computation of the cursor position,
this printer expect the contracts of the methods print(String)
and println(String)
has been respected through all method calls, meaning the source string passed as argument to those method
calls did not contain newline/carriage-return characters.
public void wrapToColumn(int column)
column
- the column to align topublic String getSource()
Copyright © 2007–2018. All rights reserved.