gishur.graph.core
Class GraphFileFormat

java.lang.Object
  |
  +--gishur.graph.core.GraphFileFormat

public abstract class GraphFileFormat
extends java.lang.Object

This abstract class defines a simple streaming format for Graphs. The file format can save an array of Graphs (that may be sticked together) and may be used as part of another streaming format.

Version:
1.0
Author:
Thomas Wolf

Field Summary
static java.lang.String FILE_ID
          The id for the file format.
static byte VERSION
          The actial version number.
 
Constructor Summary
GraphFileFormat()
           
 
Method Summary
static Graph readGraph(java.io.InputStream istream)
          Reads a single Graph from the given InputStream.
static Graph readGraph(java.lang.String filename)
          Reads a single Graph from the specified file.
static Graph[] readGraphs(java.io.InputStream istream)
          Reads an array of Graphs from the given InputStream.
static Graph[] readGraphs(java.lang.String filename)
          Reads an array of Graphs from the specified file.
static void writeGraph(Graph graph, java.io.OutputStream ostream)
          Writes a single Graph to a given OutputStream.
static void writeGraph(Graph graph, java.lang.String filename)
          Writes a single Graph to the specified file.
static void writeGraphs(Graph[] graphs, java.io.OutputStream ostream)
          Writes an array of Graphs to a given OutputStream.
static void writeGraphs(Graph[] graphs, java.lang.String filename)
          Writes an array of Graphs to the specified file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_ID

public static final java.lang.String FILE_ID
The id for the file format.

VERSION

public static final byte VERSION
The actial version number.
Constructor Detail

GraphFileFormat

public GraphFileFormat()
Method Detail

writeGraphs

public static void writeGraphs(Graph[] graphs,
                               java.io.OutputStream ostream)
                        throws java.io.IOException
Writes an array of Graphs to a given OutputStream.
Parameters:
graphs - array of Graphs to write
ostream - the OutputStream to use for writing
Throws:
java.io.IOException -  

writeGraph

public static void writeGraph(Graph graph,
                              java.io.OutputStream ostream)
                       throws java.io.IOException
Writes a single Graph to a given OutputStream.
Parameters:
graph - the Graph to write
ostream - the OutputStream to use for writing
Throws:
java.io.IOException -  

writeGraphs

public static void writeGraphs(Graph[] graphs,
                               java.lang.String filename)
Writes an array of Graphs to the specified file.
Parameters:
graphs - array of Graphs to write
filname - specifies the file to write the Graphs to
Throws:
java.io.IOException -  

writeGraph

public static void writeGraph(Graph graph,
                              java.lang.String filename)
Writes a single Graph to the specified file.
Parameters:
graph - the Graph to write
filname - specifies the file to write the Graph to
Throws:
java.io.IOException -  

readGraphs

public static Graph[] readGraphs(java.io.InputStream istream)
                          throws java.io.IOException,
                                 java.lang.ClassNotFoundException
Reads an array of Graphs from the given InputStream.
Parameters:
istream - the InputStream to use
Returns:
read array of Graphs

readGraph

public static Graph readGraph(java.io.InputStream istream)
                       throws java.io.IOException,
                              java.lang.ClassNotFoundException
Reads a single Graph from the given InputStream.
Parameters:
istream - the InputStream to use
Returns:
read Graph

readGraphs

public static Graph[] readGraphs(java.lang.String filename)
Reads an array of Graphs from the specified file.
Parameters:
filname - specifies the file to read the Graphs from
Returns:
read array of Graphs

readGraph

public static Graph readGraph(java.lang.String filename)
Reads a single Graph from the specified file.
Parameters:
filname - specifies the file to read the Graph from
Returns:
read Graph