easik.sketch.util
Class SketchFileIO

java.lang.Object
  extended by easik.sketch.util.SketchFileIO

public class SketchFileIO
extends java.lang.Object

Here is a collection of static methods which are used to save and load Sketches from XML.

Version:
2006-07-14 Vera Ranieri
Author:
Rob Fletcher 2005, Kevin Green 2006, Vera Ranieri 2006

Constructor Summary
SketchFileIO()
           
 
Method Summary
static boolean graphicalSketchFromXML(java.io.File inputFile, Sketch outputSketch)
          Load a sketch from XML.
static boolean initializeExportHandlerFromXML(java.io.File inputFile, ExportHandler eHandler)
          Method to initialize an ExportHandler from a supplied XML file
static boolean initializeSketchHandlerFromXML(java.io.File inputFile, SketchHandler sketchHandler)
          Method to initialize a SketchHandler for a supplied XML file
private static void outputXMLtoFile(java.io.File outputFile, org.w3c.dom.Document xml)
          Output the document as XML
static boolean sketchToXML(java.io.File outputFile, Sketch inputSketch)
          Converts a sketch to an XML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SketchFileIO

public SketchFileIO()
Method Detail

sketchToXML

public static boolean sketchToXML(java.io.File outputFile,
                                  Sketch inputSketch)
Converts a sketch to an XML file. The empty sketch is provided by the method which calls this, it should be empty, or else it will get crowded. Returns the success of the save.

Parameters:
outputFile - The file we will output to
inputSketch - The sketch we're reading to
Returns:
True if successful, false otherwise

outputXMLtoFile

private static void outputXMLtoFile(java.io.File outputFile,
                                    org.w3c.dom.Document xml)
Output the document as XML

Parameters:
outputFile - output file
xml - output XML

graphicalSketchFromXML

public static boolean graphicalSketchFromXML(java.io.File inputFile,
                                             Sketch outputSketch)
Load a sketch from XML.

Parameters:
inputFile - the file from which the XML will be read
outputSketch - The sketch which will be getting the new values
Returns:
Returns the success or failure of the reading.

initializeSketchHandlerFromXML

public static boolean initializeSketchHandlerFromXML(java.io.File inputFile,
                                                     SketchHandler sketchHandler)
Method to initialize a SketchHandler for a supplied XML file

Parameters:
inputFile - The XML file containing the sketch information
sketchHandler - An instance of a sketchHandler.
Returns:
true if SketchHandler was initialized, false if an exception occurred.
Since:
2006-05-17 Vera Ranieri

initializeExportHandlerFromXML

public static boolean initializeExportHandlerFromXML(java.io.File inputFile,
                                                     ExportHandler eHandler)
Method to initialize an ExportHandler from a supplied XML file

Parameters:
inputFile - The XML file containing the information
eHandler - An instance of an ExportHandler
Returns:
true if SQLHandler was initialized, false if an exceptionn occurred.
Since:
2006-05-18 Vera Ranieri