Package org.codehaus.janino.util
Class AutoIndentWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.FilterWriter
-
- org.codehaus.janino.util.AutoIndentWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.Appendable
,java.lang.AutoCloseable
public class AutoIndentWriter extends java.io.FilterWriter
AFilterWriter
that indents lines by processing some control characters in the character stream.INDENT
orUNINDENT
may precede lines and indicate that the line and all following lines should be (un)indented by one position.TABULATOR
s may appear anywhere in lines and dictate that portions of all following lines should be vertically aligned (seeresolveTabs(List)
).
-
-
Field Summary
Fields Modifier and Type Field Description static char
CLEAR_TABULATORS
Special character at the beginning of a line that flushes a tabular layout.static char
INDENT
Special character at the beginning of a line that indents the following text by one position.static char
TABULATOR
Special character indicating a tabular layout of all following lines untilUNINDENT
.static char
UNINDENT
Special character at the beginning of a line that unindents the following text by one position.
-
Constructor Summary
Constructors Constructor Description AutoIndentWriter(java.io.Writer out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
void
write(char[] cbuf, int off, int len)
void
write(int c)
void
write(java.lang.String str, int off, int len)
-
-
-
Field Detail
-
TABULATOR
public static final char TABULATOR
Special character indicating a tabular layout of all following lines untilUNINDENT
.- See Also:
- Constant Field Values
-
CLEAR_TABULATORS
public static final char CLEAR_TABULATORS
Special character at the beginning of a line that flushes a tabular layout.- See Also:
- Constant Field Values
-
INDENT
public static final char INDENT
Special character at the beginning of a line that indents the following text by one position.- See Also:
- Constant Field Values
-
UNINDENT
public static final char UNINDENT
Special character at the beginning of a line that unindents the following text by one position.- See Also:
- Constant Field Values
-
-
Method Detail
-
write
public void write(@Nullable char[] cbuf, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterWriter
- Throws:
java.io.IOException
-
write
public void write(@Nullable java.lang.String str, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterWriter
- Throws:
java.io.IOException
-
write
public void write(int c) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterWriter
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.FilterWriter
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.FilterWriter
- Throws:
java.io.IOException
-
-