Class ProgramWriter
Class ProgramWriter
Object
|
+----Writer
|
+----PrintWriter
|
+----ProgramWriter
- public class ProgramWriter
- extends PrintWriter
This class provides a simple wrapper for PrintWriter.
It is used to provide indentation for recursively
generated programs.
- Version:
- 1.0
- Author:
- Craig Cleaveland
-
ProgramWriter(Writer)
- Creates a new ProgramWriter from a Writer object.
-
ProgramWriter(OutputStream)
- Creates a new ProgramWriter from an OutputStream object.
-
getIndent()
- Returns the current Indent string.
-
print(char)
-
-
print(String)
- Prints the string to the output.
-
println(String)
- Prints the string and a new line character.
-
setIndent(String)
- Sets the indentation.
ProgramWriter
public ProgramWriter(Writer w)
- Creates a new ProgramWriter from a Writer object.
ProgramWriter
public ProgramWriter(OutputStream o)
- Creates a new ProgramWriter from an OutputStream object.
getIndent
public java.lang.String getIndent()
- Returns the current Indent string.
print
public void print(char ch)
- Overrides:
- print in class PrintWriter
print
public void print(String str)
- Prints the string to the output.
Each newline character is prefixed with the Indent string.
- Overrides:
- print in class PrintWriter
println
public void println(String s)
- Prints the string and a new line character.
- Overrides:
- println in class PrintWriter
setIndent
public void setIndent(String s)
- Sets the indentation.
ProgramWriter objects will prefix each line with the
Indent string which is typically blank characters.
It is used to help format generated programs that are
created recursively, so that each recursion indents the
generated code.