Search this API

y.io
Class GraphMLIOHandler

java.lang.Object
  extended by y.io.IOHandler
      extended by y.io.GraphMLIOHandler
Direct Known Subclasses:
ZipGraphMLIOHandler

public class GraphMLIOHandler
extends IOHandler

Read and write a Graph2D in GraphML format.

This is mainly achieved by delegating the actual work to an instance of GraphMLHandler which is accessible through getGraphMLHandler().

For more information about the GraphML file format refer to the official GraphML Page.

 

Constructor Summary
GraphMLIOHandler()
           
 
Method Summary
 void addEdgeRealizerSerializer(EdgeRealizerSerializer ers)
          Convenience method to register an EdgeRealizerSerializer
 void addNodeRealizerSerializer(NodeRealizerSerializer nrs)
          Convenience method to register a NodeRealizerSerializer
protected  Graph2DGraphMLHandler createGraphMLHandler()
          Initialize the core GraphMLHandler.
 java.lang.String getFileFormatString()
          Returns a descriptive string of the supported file format.
 java.lang.String getFileNameExtension()
          Returns the file name extension of the supported file format.
 Graph2DGraphMLHandler getGraphMLHandler()
          Get the GraphMLHandler implementation that does the low level work.
 void read(Graph2D graph, org.w3c.dom.Document documentElement)
          Read graph from an already parsed Document instance.
 void read(Graph2D graph, java.io.InputStream in)
          Adds the contents that are read from the stream to the given graph.
 void write(Graph2D graph, java.io.OutputStream out)
          Writes the contents of the given graph to a stream
 void write(Graph2D graph, java.io.Writer out)
          Write graph to a Writer instance.
 
Methods inherited from class y.io.IOHandler
canRead, canWrite, canWriteSubset, createObjectInputStream, createObjectOutputStream, hide, read, 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

GraphMLIOHandler

public GraphMLIOHandler()
Method Detail

getGraphMLHandler

public Graph2DGraphMLHandler getGraphMLHandler()
Get the GraphMLHandler implementation that does the low level work.

Returns:
The GraphMLHandler implementation for the actual GraphML processing.

createGraphMLHandler

protected Graph2DGraphMLHandler createGraphMLHandler()
Initialize the core GraphMLHandler.

Returns:
The core GraphMLHandler.

write

public void write(Graph2D graph,
                  java.io.OutputStream out)
           throws java.io.IOException
Description copied from class: IOHandler
Writes the contents of the given graph to a stream

Specified by:
write in class IOHandler
Throws:
java.io.IOException

write

public void write(Graph2D graph,
                  java.io.Writer out)
           throws java.io.IOException
Write graph to a Writer instance.

Throws:
java.io.IOException

read

public void read(Graph2D graph,
                 java.io.InputStream in)
          throws java.io.IOException
Description copied from class: IOHandler
Adds the contents that are read from the stream to the given graph. The given graph will not be cleared when the content of the file will be added to it.

Specified by:
read in class IOHandler
Throws:
java.io.IOException

getFileFormatString

public java.lang.String getFileFormatString()
Description copied from class: IOHandler
Returns a descriptive string of the supported file format.

Specified by:
getFileFormatString in class IOHandler

getFileNameExtension

public java.lang.String getFileNameExtension()
Description copied from class: IOHandler
Returns the file name extension of the supported file format. The extension does not include the separating dot (i.e, '.').

Specified by:
getFileNameExtension in class IOHandler

addNodeRealizerSerializer

public void addNodeRealizerSerializer(NodeRealizerSerializer nrs)
Convenience method to register a NodeRealizerSerializer


addEdgeRealizerSerializer

public void addEdgeRealizerSerializer(EdgeRealizerSerializer ers)
Convenience method to register an EdgeRealizerSerializer


read

public void read(Graph2D graph,
                 org.w3c.dom.Document documentElement)
          throws java.io.IOException
Read graph from an already parsed Document instance.

Note: documentElement must be parsed with namespace information, i.e. DocumentBuilderFactory.setNamespaceAware(boolean) must be set to true.

Throws:
java.io.IOException

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