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

Constructor Index

 o ProgramWriter(Writer)
Creates a new ProgramWriter from a Writer object.
 o ProgramWriter(OutputStream)
Creates a new ProgramWriter from an OutputStream object.

Method Index

 o getIndent()
Returns the current Indent string.
 o print(char)
 o print(String)
Prints the string to the output.
 o println(String)
Prints the string and a new line character.
 o setIndent(String)
Sets the indentation.

Constructors

 o ProgramWriter
public ProgramWriter(Writer w)
Creates a new ProgramWriter from a Writer object.

 o ProgramWriter
public ProgramWriter(OutputStream o)
Creates a new ProgramWriter from an OutputStream object.

Methods

 o getIndent
public java.lang.String getIndent()
Returns the current Indent string.

 o print
public void print(char ch)
Overrides:
print in class PrintWriter
 o 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
 o println
public void println(String s)
Prints the string and a new line character.

Overrides:
println in class PrintWriter
 o 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.