public class IndentingWriter extends Writer
Modifier and Type | Field and Description |
---|---|
protected int |
indentationLevel
The current indentation level, i.e.
|
protected Writer |
out
The underlying writer.
|
Constructor and Description |
---|
IndentingWriter(Writer out) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
decreaseIndentation()
Decrease indentation level by 1.
|
void |
flush() |
int |
getCharactersSinceEOL()
Get the number of characters read since end-of-line.
|
int |
getIndentationLevel()
Get the indentation level (number of tabs or indentation string).
|
String |
getIndentationString()
Gets the string used for indentation.
|
void |
increaseIndentation()
Increase indentation level by 1.
|
void |
setIndentationLevel(int indentationLevel)
Set indentation level (number of tabs or indentation string).
|
void |
setIndentationString(String indentString)
Sets the string that should be used for indentation.
|
void |
write(char[] cbuf,
int off,
int len) |
void |
write(String str,
int off,
int len) |
void |
writeEOL()
Writes an end-of-line character sequence and triggers the indentation for the text written on the next line.
|
protected Writer out
protected int indentationLevel
public IndentingWriter(Writer out)
public void setIndentationString(String indentString)
indentString
- The indentation string, e.g. a tab or a number of spaces.public String getIndentationString()
public int getIndentationLevel()
public void setIndentationLevel(int indentationLevel)
indentationLevel
- level as an integerpublic int getCharactersSinceEOL()
public void increaseIndentation()
public void decreaseIndentation()
public void writeEOL() throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
public void write(String str, int off, int len) throws IOException
write
in class Writer
IOException
public void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
IOException
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.