Search this API

y.io
Class XGMLIOHandler

java.lang.Object
  extended by y.io.IOHandler
      extended by y.io.GMLIOHandler
          extended by y.io.XGMLIOHandler

public class XGMLIOHandler
extends GMLIOHandler

This class is closely related to GMLIOHandler, it produces structurally the same output as GMLIOHandler but uses well formed xml for the actual writing and reading. A very simple and thus highly extensible DTD is being used for this "gml over xml" format.

Note that this class can only be used with J2SE 1.4 or higher.


Constructor Summary
XGMLIOHandler()
          Creates a new instance of XGMLIOHandler
 
Method Summary
 String getFileFormatString()
          Returns the XGML file format string.
 String getFileNameExtension()
          Returns the XGML file name extension, i.e.
 void read(Graph2D graph, InputStream in)
          Adds the contents from the given stream to the given graph.
protected  void read(Graph2D graph, Reader reader)
          Fills the contents of the given graph from a reader.
 void read(Graph2D graph, String name)
          Generates a FileReader and passes control to GMLIOHandler.read(y.view.Graph2D, java.io.Reader)
 void write(Graph2D graph, OutputStream out)
          Writes the contents of the given graph in GML format to a stream.
 
Methods inherited from class y.io.GMLIOHandler
convertColor, decodeColor, getEncoderFactory, getParserFactory, setEncoderFactory, setParserFactory
 
Methods inherited from class y.io.IOHandler
canRead, canWrite, canWriteSubset, createObjectInputStream, createObjectOutputStream, hide, read, shouldSerialize, shouldSerialize, write, writeSubset, writeSubset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XGMLIOHandler

public XGMLIOHandler()
Creates a new instance of XGMLIOHandler

Method Detail

getFileFormatString

public String getFileFormatString()
Returns the XGML file format string.

Overrides:
getFileFormatString in class GMLIOHandler
Returns:
the string

getFileNameExtension

public String getFileNameExtension()
Returns the XGML file name extension, i.e. "xgml"

Overrides:
getFileNameExtension in class GMLIOHandler
Returns:
"xgml"

write

public void write(Graph2D graph,
                  OutputStream out)
           throws IOException
Description copied from class: GMLIOHandler
Writes the contents of the given graph in GML format to a stream. This is achieved by using the currently installed EncoderFactory, obtaining a ObjectEncoder for GML and invoking the ObjectEncoder.encode(Object, y.io.gml.GMLEncoder) method with the graph as the first argument.

Overrides:
write in class GMLIOHandler
Throws:
IOException - in case of an I/O Exception
Parameters:
graph - the graph to be written
out - The OutputStream being written to.

read

protected void read(Graph2D graph,
                    Reader reader)
             throws IOException
Fills the contents of the given graph from a reader.

Overrides:
read in class GMLIOHandler
Throws:
IOException - in case of an I/O Exception
Parameters:
graph - the graph to be filled
reader - The reader being read from

read

public void read(Graph2D graph,
                 InputStream in)
          throws IOException
Description copied from class: GMLIOHandler
Adds the contents from the given stream to the given graph.

Overrides:
read in class GMLIOHandler
Throws:
IOException
in - The input stream being read from

read

public void read(Graph2D graph,
                 String name)
          throws IOException
Description copied from class: GMLIOHandler
Generates a FileReader and passes control to GMLIOHandler.read(y.view.Graph2D, java.io.Reader)

Overrides:
read in class GMLIOHandler
Throws:
IOException - in the case of an I/O error
Parameters:
graph - the graph
name - the filename

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.