scg.ac.ni.pmf.newgraph.io
Interface GraphFileType

All Superinterfaces:
java.io.Serializable

public interface GraphFileType
extends java.io.Serializable

Classes implementing this interface provide support for a certain file type for storing graphs. Each class should implement methods to store the graph in a file, load a graph from the file, and tell if it accepts the given file.

Author:
Vladimir Brankov
See Also:
"Plug-in Developer Guide", GraphRWException

Method Summary
 boolean accepts(java.io.File file)
          Retrieves if the file is readable by this graph reader.
 java.lang.String getExtension()
          Retrieves the file extension for the file type.
 java.lang.String getName()
          Retrieves the name of the file type.
 void read(java.io.File file, Graph graph)
          The method should Read the file and enter the data in the graph.
 void write(java.io.File file, GraphData data)
          The method should write the graph data into the file.
 

Method Detail

read

void read(java.io.File file,
          Graph graph)
          throws GraphRWException,
                 java.io.IOException
The method should Read the file and enter the data in the graph. The method gets an empty graph object, and should initialize it with the data from the file.

Parameters:
file - The file.
graph - The graph.
Throws:
GraphRWException - In the case of the reader error.
java.io.IOException - In the case of the IO error.

write

void write(java.io.File file,
           GraphData data)
           throws GraphRWException,
                  java.io.IOException
The method should write the graph data into the file.

Parameters:
file - The file.
data - The data about the graph.
Throws:
GraphRWException - In the case of the writer error.
java.io.IOException - In the case of the IO error.

accepts

boolean accepts(java.io.File file)
Retrieves if the file is readable by this graph reader.

Parameters:
file - The file.
Returns:
boolean Indicates whether the file is acceptable for reading.

getName

java.lang.String getName()
Retrieves the name of the file type.

Returns:
String The name.

getExtension

java.lang.String getExtension()
Retrieves the file extension for the file type. Example: "xml", "gr".

Returns:
String The file extension.


Copyright © 2004 Dragan Stevanovic, Vladimir Brankov.