byucc.edif
Class EdifPrintWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.PrintWriter
          extended bybyucc.edif.EdifPrintWriter
All Implemented Interfaces:
java.io.Serializable

public class EdifPrintWriter
extends java.io.PrintWriter
implements java.io.Serializable

Used for generating valid Edif text output. This class extends PrintWriter but also contains a number of convenience methods for properly formatting Edif output.

This class keeps track of the indentation during formatted printing. An integer value (_indenture) keeps track of the indentation level and the _indentString is used as the String printed for each level of indentation.

To Do:

Version:
$Id: EdifPrintWriter.java,v 1.18 2004/08/27 19:16:42 tsa6 Exp $
Author:
Mike Wirthlin, Tyler Anderson
See Also:
Serialized Form

Field Summary
private static java.lang.String _endOfLineChar
          Contains the endOfLineChar.
private static java.lang.String _indentString
          Contains the indent String.
private  int _indenture
          Contains the amount of indenture.
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
EdifPrintWriter(java.io.OutputStream out)
          Constructs an EdifPrintWriter Object using the passed-in OutputStream as its output.
EdifPrintWriter(java.lang.String outputFilename)
          Constructs an EdifPrintWriter Object that will write to the passed in String filename.
 
Method Summary
 void decrIndent()
          Decrements the amount of indenture.
 void incrIndent()
          Increments the amount of indenture.
static void printEdifEnvironment(java.lang.String filename, EdifCell cell, EdifEnvironment subFile)
          This method will create a new Edif file for a given EdifCell object, and print it to the passed-in filename.
 void printIndent(java.lang.String str)
          Prints the passed-in String object with the right amount of preceding indentation.
 void println()
          Prints the end of line character to the PrintWriter.
 void println(java.lang.String str)
          Prints out the passed-in string followed by the end of line character.
 void printlnIndent(java.lang.String str)
          Prints the passed-in String object with the right amount of preceding indentation, followed by the end of line characther.
 void printQuote(java.lang.String str)
          Prints quotes around the passed in String object.
 
Methods inherited from class java.io.PrintWriter
checkError, close, flush, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_indenture

private int _indenture
Contains the amount of indenture.


_indentString

private static final java.lang.String _indentString
Contains the indent String.

See Also:
Constant Field Values

_endOfLineChar

private static final java.lang.String _endOfLineChar
Contains the endOfLineChar.

See Also:
Constant Field Values
Constructor Detail

EdifPrintWriter

public EdifPrintWriter(java.io.OutputStream out)
Constructs an EdifPrintWriter Object using the passed-in OutputStream as its output.

Parameters:
out - The OutputStream Object that this EdifPrintWriter Object will write to

EdifPrintWriter

public EdifPrintWriter(java.lang.String outputFilename)
                throws java.io.IOException
Constructs an EdifPrintWriter Object that will write to the passed in String filename.

Parameters:
outputFilename - The file that this EdifPrintWriter Object will write to
Method Detail

decrIndent

public void decrIndent()
Decrements the amount of indenture.


incrIndent

public void incrIndent()
Increments the amount of indenture.


printQuote

public void printQuote(java.lang.String str)
Prints quotes around the passed in String object.

Parameters:
str - The String object that will have quotes printed around it

println

public void println(java.lang.String str)
Prints out the passed-in string followed by the end of line character.

Parameters:
str - The String that will be written to the PrintWriter followed by the end of line character

println

public void println()
Prints the end of line character to the PrintWriter.


printIndent

public void printIndent(java.lang.String str)
Prints the passed-in String object with the right amount of preceding indentation.

Parameters:
str - The String object that will be printed preceded by indentation

printlnIndent

public void printlnIndent(java.lang.String str)
Prints the passed-in String object with the right amount of preceding indentation, followed by the end of line characther.

Parameters:
str - The String object that will be printed preceded by indentation, and followed by the end of line character

printEdifEnvironment

public static void printEdifEnvironment(java.lang.String filename,
                                        EdifCell cell,
                                        EdifEnvironment subFile)
                                 throws java.io.IOException
This method will create a new Edif file for a given EdifCell object, and print it to the passed-in filename.

Parameters:
filename - The name of the file to generate
cell - The EdifCell object that is to be put into the top-level of the generated Edif file.
subFile - The EdifEnvironment object that owns the cell.
Throws:
java.io.IOException