sofya.graphs.irg
Class IRGHandler

java.lang.Object
  extended by sofya.base.Handler
      extended by sofya.graphs.irg.IRGHandler

public class IRGHandler
extends Handler

The IRGHandler provides routines to read and write interclass relation graph ('.prog.irg') files in the Sofya database.

Since there is a one-to-one mapping between IRGs and their corresponding database files, static methods suffice to read and write the database files. Thus this handler cannot be instantiated.

Version:
10/04/2004
Author:
Alex Kinneer
See Also:
IRG

Field Summary
 
Fields inherited from class sofya.base.Handler
HANDLER_EXTENSIONS, LINE_SEP
 
Method Summary
static void main(java.lang.String[] argv)
          Test driver for IRGHandler.
static IRG readIRGFile(java.lang.String fileName, java.lang.String tag)
          Reads an interclass relation graph from a '.prog.irg' file in the database directory.
static void writeIRGFile(java.lang.String fileName, java.lang.String tag, IRG irg)
          Writes an interclass relation graph to a '.prog.irg' file in the database directory.
 
Methods inherited from class sofya.base.Handler
copyFile, createCacheFile, disableParseNumbers, ensureTagExists, formatSignature, isIntAvailable, isStringAvailable, newCache, openCacheFile, openInputFile, openInputFile, openOutputFile, openOutputFile, parseClass, prepareTokenizer, readInt, readIntIgnoreEOL, readJarClasses, readNextLine, readProgFile, readString, readStringIgnoreEOL, readToEOL, readToNextDataLine, toBinary, toHex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

writeIRGFile

public static void writeIRGFile(java.lang.String fileName,
                                java.lang.String tag,
                                IRG irg)
                         throws java.io.IOException
Writes an interclass relation graph to a '.prog.irg' file in the database directory.

Parameters:
fileName - Name of the IRG database file to be written. This should include the '.prog' portion of the extension.
tag - Database tag to be associated with the file.
irg - Interclass relation graph to be written to the database file.
Throws:
java.io.IOException - If there is an error writing to the file.

readIRGFile

public static IRG readIRGFile(java.lang.String fileName,
                              java.lang.String tag)
                       throws java.io.FileNotFoundException,
                              EmptyFileException,
                              BadFileFormatException,
                              java.io.IOException
Reads an interclass relation graph from a '.prog.irg' file in the database directory.

Parameters:
fileName - Name of the IRG database file to be read. This should include the '.prog' portion of the extension.
tag - Database tag associated with the file.
Returns:
The IRG read from the specified database file.
Throws:
java.io.FileNotFoundException - If the specified file doesn't exist.
EmptyFileException - If the specified file contains no data.
BadFileFormatException - If the specified file is not an IRG file or is otherwise malformed or corrupted.
java.io.IOException - If there is an error reading from the IRG file.

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Test driver for IRGHandler.

Throws:
java.lang.Exception