de.uka.algo.io
Class JungIOUtils

java.lang.Object
  extended by de.uka.algo.io.JungIOUtils

public class JungIOUtils
extends java.lang.Object

Some utility methods for handling GraphML in Jung.

Author:
stm TODO DOCUMENT ME!

Constructor Summary
JungIOUtils()
           
 
Method Summary
static edu.uci.ics.jung.graph.Graph loadGraphFile(java.io.File filename)
          Loads a Graph from a GraphML file.
static edu.uci.ics.jung.graph.Graph loadGraphFile(java.net.URL url)
          Loads a Graph from a GraphML file.
static edu.uci.ics.jung.graph.Graph loadGraphResource(java.lang.String filename)
          Loads a Graph from a GraphML resource.
static void writeGraphFile(edu.uci.ics.jung.graph.Graph graph, java.io.File filename)
          Writes a Jung Graph to a file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JungIOUtils

public JungIOUtils()
Method Detail

loadGraphFile

public static edu.uci.ics.jung.graph.Graph loadGraphFile(java.io.File filename)
                                                  throws java.io.IOException
Loads a Graph from a GraphML file.

Parameters:
filename - The name of the GraphML file to load
Returns:
A Graph containing the graph described in the file.
Throws:
java.io.IOException - if file is not found

loadGraphFile

public static edu.uci.ics.jung.graph.Graph loadGraphFile(java.net.URL url)
                                                  throws java.io.IOException
Loads a Graph from a GraphML file.

Parameters:
url - The name of the GraphML file to load
Returns:
A Graph containing the graph described in the file.
Throws:
java.io.IOException - if file is not found

loadGraphResource

public static edu.uci.ics.jung.graph.Graph loadGraphResource(java.lang.String filename)
                                                      throws java.io.IOException
Loads a Graph from a GraphML resource. This methods tries to find the resource specified by filename and load the corresponding GraphML file resource.

Parameters:
filename - The name of the GraphML file to load
Returns:
A Graph containing the graph described in the file
Throws:
java.io.IOException - if resource is not found

writeGraphFile

public static void writeGraphFile(edu.uci.ics.jung.graph.Graph graph,
                                  java.io.File filename)
                           throws java.io.IOException
Writes a Jung Graph to a file.

Parameters:
graph - A Jung Graph
filename - location of the output file
Throws:
java.io.IOException