com.sun.electric.tool.io.output
Class Output

java.lang.Object
  extended by com.sun.electric.tool.io.output.Output
Direct Known Subclasses:
ArchSim, DXF, Eagle, ECAD, ELIB, FastHenry, Geometry, HPGL, IRSIM, JELIB, L, LEF, Maxwell, Pads, PAL, PNG, PostScript, Sim, Topology

public class Output
extends java.lang.Object

This class manages writing files in different formats. The class is subclassed by the different file writers.


Nested Class Summary
static class Output.OutputCellInfo
          Class to define cell information during output.
static class Output.WriteJELIB
          Class to write a library in a CHANGE Job.
 
Field Summary
protected  java.io.DataOutputStream dataOutputStream
          for writing binary files
protected  java.lang.String filePath
          file path
protected  java.io.PrintWriter printWriter
          for writing text files
protected  boolean quiet
          True to write with less information displayed
 
Constructor Summary
Output()
           
 
Method Summary
protected  boolean closeBinaryOutputStream()
          Closes the dataOutputStream.
protected  boolean closeTextOutputStream()
          Close the printWriter.
protected  void emitCopyright(java.lang.String prefix, java.lang.String postfix)
           
static void exportCellCommand(Cell cell, VarContext context, java.lang.String filePath, FileType type, java.util.List<PolyBase> override)
          This is the non-interactive version of exportCellCommand
static java.awt.geom.Rectangle2D getAreaToPrint(Cell cell, boolean reduce, EditWindow_ wnd)
          Method to determine the area of a cell that is to be printed.
protected  boolean openBinaryOutputStream(java.lang.String filePath)
          Opens the dataOutputStream for writing of binary files.
protected  boolean openTextOutputStream(java.lang.String filePath)
          Open the printWriter for writing text files
static boolean saveJelib(java.lang.String newName, Library lib)
          Method to write an entire Library in JELIB format.
protected  void setContinuationString(java.lang.String str)
           
protected  void setOutputWidth(int width, boolean strict)
           
protected  boolean writeCell(Cell cell, VarContext context)
          Method to write a cell.
static void writeCell(Cell cell, VarContext context, java.lang.String filePath, FileType type, java.util.List<PolyBase> override)
          Method to write a Cell to a file with a particular format.
static boolean writeLibrary(Library lib, FileType type, boolean compatibleWith6, boolean quiet, boolean delibHeaderOnly)
          Method to write an entire Library with a particular format.
static boolean writePanicSnapshot(Snapshot panicSnapshot, java.io.File panicDir, boolean oldRevision)
          Method to write all Libraries in Snapsht into a panic directory.
protected  void writeWidthLimited(java.lang.String str)
          Write to the file, but break into printable lines
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filePath

protected java.lang.String filePath
file path


printWriter

protected java.io.PrintWriter printWriter
for writing text files


dataOutputStream

protected java.io.DataOutputStream dataOutputStream
for writing binary files


quiet

protected boolean quiet
True to write with less information displayed

Constructor Detail

Output

public Output()
Method Detail

exportCellCommand

public static void exportCellCommand(Cell cell,
                                     VarContext context,
                                     java.lang.String filePath,
                                     FileType type,
                                     java.util.List<PolyBase> override)
This is the non-interactive version of exportCellCommand

Parameters:
cell - the Cell to be written.
context - the VarContext of the Cell (its position in the hierarchy above it).
filePath - the path to the disk file to be written.
type - the format of the output file.
override - a list of Polys to draw instead of the cell contents.

writeCell

protected boolean writeCell(Cell cell,
                            VarContext context)
Method to write a cell. This method is never called. Instead, it is always overridden by the appropriate write subclass.

Parameters:
cell - the Cell to be written.
context - the VarContext of the cell (for parameter evaluation)
Returns:
true on error.

writePanicSnapshot

public static boolean writePanicSnapshot(Snapshot panicSnapshot,
                                         java.io.File panicDir,
                                         boolean oldRevision)
Method to write all Libraries in Snapsht into a panic directory.

Parameters:
panicSnapshot - Snapshot to save.
panicDir - panic directory to save.
Returns:
true on error.

saveJelib

public static boolean saveJelib(java.lang.String newName,
                                Library lib)
Method to write an entire Library in JELIB format. This method doesn't modifiy library, so it can be run out of Job.

Parameters:
newName - name which is used to prepare file name of the library.
lib - library to save

writeLibrary

public static boolean writeLibrary(Library lib,
                                   FileType type,
                                   boolean compatibleWith6,
                                   boolean quiet,
                                   boolean delibHeaderOnly)
Method to write an entire Library with a particular format. This is used for output formats that capture the entire library (only the ELIB and Readable Dump formats). The alternative to writing the entire library is writing a single cell and the hierarchy below it (use "writeCell").

Parameters:
lib - the Library to be written.
type - the format of the output file.
compatibleWith6 - true to write a library that is compatible with version 6 Electric.
quiet - true to save with less information displayed.
delibHeaderOnly - true to write only the header for a DELIB type library
Returns:
true on error.

writeCell

public static void writeCell(Cell cell,
                             VarContext context,
                             java.lang.String filePath,
                             FileType type,
                             java.util.List<PolyBase> override)
Method to write a Cell to a file with a particular format. In addition to the specified Cell, these formats typically also include the hierarchy below it. The alternative is to write the entire library, regardless of hierarchical structure (use "WriteLibrary").

Parameters:
cell - the Cell to be written.
context - the VarContext of the Cell (its position in the hierarchy above it).
filePath - the path to the disk file to be written.
type - the format of the output file.
override - a list of overriding polygons to write. NOTE: Keep public for regressions

openBinaryOutputStream

protected boolean openBinaryOutputStream(java.lang.String filePath)
Opens the dataOutputStream for writing of binary files.

Returns:
true on error.

closeBinaryOutputStream

protected boolean closeBinaryOutputStream()
Closes the dataOutputStream.

Returns:
true on error.

openTextOutputStream

protected boolean openTextOutputStream(java.lang.String filePath)
Open the printWriter for writing text files

Returns:
true on error.

closeTextOutputStream

protected boolean closeTextOutputStream()
Close the printWriter.

Returns:
true on error.

emitCopyright

protected void emitCopyright(java.lang.String prefix,
                             java.lang.String postfix)

setOutputWidth

protected void setOutputWidth(int width,
                              boolean strict)

setContinuationString

protected void setContinuationString(java.lang.String str)

writeWidthLimited

protected void writeWidthLimited(java.lang.String str)
Write to the file, but break into printable lines


getAreaToPrint

public static java.awt.geom.Rectangle2D getAreaToPrint(Cell cell,
                                                       boolean reduce,
                                                       EditWindow_ wnd)
Method to determine the area of a cell that is to be printed. Returns null if the area cannot be determined.