public class IndentedWriter extends Object
Modifier and Type | Field and Description |
---|---|
protected int |
column |
protected int |
currentIndent |
protected boolean |
flatMode |
protected static int |
INDENT |
protected boolean |
lineNumbers |
protected Writer |
out |
protected int |
row |
protected boolean |
startingNewLine |
static IndentedWriter |
stderr
Stderr wrapped in an IndentedWriter - no line numbers
|
static IndentedWriter |
stdout
Stdout wrapped in an IndentedWriter - no line numbers
|
protected int |
unitIndent |
Modifier | Constructor and Description |
---|---|
|
IndentedWriter() |
protected |
IndentedWriter(IndentedWriter other) |
|
IndentedWriter(OutputStream outStream) |
|
IndentedWriter(OutputStream outStream,
boolean withLineNumbers) |
|
IndentedWriter(Writer writer) |
protected |
IndentedWriter(Writer writer,
boolean withLineNumbers) |
Modifier and Type | Method and Description |
---|---|
boolean |
atLineStart() |
void |
close() |
void |
decIndent() |
void |
decIndent(int x) |
void |
ensureStartOfLine() |
void |
flush() |
int |
getCol() |
int |
getCurrentOffset()
Position past current indent
|
int |
getIndent() |
char |
getPadChar() |
String |
getPadString() |
int |
getRow() |
int |
getUnitIndent() |
boolean |
hasLineNumbers() |
void |
incIndent() |
void |
incIndent(int x) |
boolean |
inFlatMode()
Flat mode - print without NL, for a more compact representation - depends on caller
|
void |
newline() |
void |
pad() |
void |
pad(int col)
Pad to a given number of columns EXCLUDING the indent.
|
void |
pad(int col,
boolean absoluteColumn)
Pad to a given number of columns maybe including the indent.
|
void |
print(char ch) |
void |
print(char ch,
int n)
Print a char N times
|
void |
print(Object obj) |
void |
print(String s,
int n)
Print a string N times
|
void |
printf(String formatStr,
Object... args) |
void |
println() |
void |
println(char ch) |
void |
println(Object obj) |
void |
setAbsoluteIndent(int x) |
void |
setFlatMode(boolean flatMode) |
void |
setLineNumbers(boolean lineNumbers) |
void |
setPadChar(char ch) |
void |
setPadString(String str) |
void |
setUnitIndent(int x) |
public static final IndentedWriter stdout
public static final IndentedWriter stderr
protected Writer out
protected static final int INDENT
protected int unitIndent
protected int currentIndent
protected int column
protected int row
protected boolean lineNumbers
protected boolean startingNewLine
protected boolean flatMode
public IndentedWriter()
protected IndentedWriter(IndentedWriter other)
public IndentedWriter(OutputStream outStream)
public IndentedWriter(OutputStream outStream, boolean withLineNumbers)
public IndentedWriter(Writer writer)
protected IndentedWriter(Writer writer, boolean withLineNumbers)
public void print(Object obj)
public void print(char ch)
public void println(Object obj)
public void println(char ch)
public void println()
public void print(String s, int n)
public void print(char ch, int n)
public void newline()
public void ensureStartOfLine()
public void close()
public void flush()
public void pad()
public void pad(int col)
col
- Column number (first column is 1).public void pad(int col, boolean absoluteColumn)
col
- Column number (first column is 1).absoluteColumn
- Whether to include the indentpublic int getRow()
public int getCol()
public int getIndent()
public int getCurrentOffset()
public boolean hasLineNumbers()
public void setLineNumbers(boolean lineNumbers)
public boolean inFlatMode()
public void setFlatMode(boolean flatMode)
public char getPadChar()
public void setPadChar(char ch)
public String getPadString()
public void setPadString(String str)
public void incIndent()
public void incIndent(int x)
public void decIndent()
public void decIndent(int x)
public void setUnitIndent(int x)
public int getUnitIndent()
public void setAbsoluteIndent(int x)
public boolean atLineStart()
Copyright © 2014. All Rights Reserved.