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
 java.lang.String getFileFormatString()
          Returns the XGML file format string.
 java.lang.String getFileNameExtension()
          Returns the XGML file name extension, i.e.
protected  void read(Graph2D graph, org.xml.sax.InputSource source)
          Fills the contents of the given graph from the given XGML document.
 void read(Graph2D graph, java.io.InputStream in)
          Adds the contents from the given stream to the given graph.
protected  void read(Graph2D graph, java.io.Reader reader)
          Fills the contents of the given graph from a reader.
 void read(Graph2D graph, java.lang.String name)
          Generates a FileReader and passes control to GMLIOHandler.read(y.view.Graph2D, java.io.Reader)
 void write(Graph2D graph, java.io.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 java.lang.String getFileFormatString()
Returns the XGML file format string.

Overrides:
getFileFormatString in class GMLIOHandler
Returns:
the string

getFileNameExtension

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

Overrides:
getFileNameExtension in class GMLIOHandler
Returns:
"xgml"

write

public void write(Graph2D graph,
                  java.io.OutputStream out)
           throws java.io.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
Parameters:
graph - the graph to be written
out - The OutputStream being written to.
Throws:
java.io.IOException - in case of an I/O Exception

read

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

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

read

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

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

read

protected void read(Graph2D graph,
                    org.xml.sax.InputSource source)
             throws java.io.IOException
Fills the contents of the given graph from the given XGML document.

Parameters:
graph - the graph to be filled
source - the input source to be read from.
Throws:
java.io.IOException - in case of an I/O exception

read

public void read(Graph2D graph,
                 java.lang.String name)
          throws java.io.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
Parameters:
graph - the graph
name - the filename
Throws:
java.io.IOException - in the case of an I/O error

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