public class IndentedWriter extends AWriterBase implements AWriter, Closeable
Modifier and Type | Field and Description |
---|---|
static IndentedWriter |
stderr
Stderr wrapped in an IndentedWriter - no line numbers
|
static IndentedWriter |
stdout
Stdout wrapped in an IndentedWriter - no line numbers
|
Constructor and Description |
---|
IndentedWriter(OutputStream outStream)
Construct a UTF8 IndentedWriter around an OutputStream
|
IndentedWriter(OutputStream outStream,
boolean withLineNumbers)
Construct a UTF8 IndentedWriter around an OutputStream
|
Modifier and Type | Method and Description |
---|---|
boolean |
atLineStart() |
void |
close() |
void |
decIndent() |
void |
decIndent(int x) |
void |
ensureStartOfLine() |
void |
flush() |
int |
getAbsoluteIndent() |
int |
getCol()
Get the absolute column.
|
int |
getCurrentOffset()
Position past current indent
|
String |
getEndOfLineMarker() |
boolean |
getFlushOnNewline()
Flush on newline
|
int |
getIndent()
Deprecated.
Use getAbsoluteIndent()
|
char |
getPadChar() |
String |
getPadString() |
int |
getRow()
Get row/line (counts from 1)
|
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()
Pad to the indent (if we are before it)
|
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[] cbuf) |
void |
print(char ch,
int n)
Print a char N times
|
void |
print(String str) |
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(String str) |
void |
setAbsoluteIndent(int x) |
void |
setEndOfLineMarker(String marker)
Set the marker included at end of line - set to null for "none".
|
void |
setFlatMode(boolean flatMode) |
void |
setFlushOnNewline(boolean flushOnNewline) |
void |
setLineNumbers(boolean lineNumbers) |
void |
setPadChar(char ch) |
void |
setPadString(String str) |
void |
setUnitIndent(int x) |
String |
toString() |
write, write, write
public static final IndentedWriter stdout
public static final IndentedWriter stderr
public IndentedWriter(OutputStream outStream)
public IndentedWriter(OutputStream outStream, boolean withLineNumbers)
public void println(char ch)
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 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()
@Deprecated public int getIndent()
public int getAbsoluteIndent()
public void setAbsoluteIndent(int x)
public int getCurrentOffset()
public boolean hasLineNumbers()
public void setLineNumbers(boolean lineNumbers)
public String getEndOfLineMarker()
public void setEndOfLineMarker(String marker)
public boolean inFlatMode()
public void setFlatMode(boolean flatMode)
public boolean getFlushOnNewline()
public void setFlushOnNewline(boolean flushOnNewline)
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 boolean atLineStart()
Licenced under the Apache License, Version 2.0