1 package prefuse.data.io; 2 3 import java.io.File; 4 import java.io.FileNotFoundException; 5 import java.io.IOException; 6 import java.io.InputStream; 7 import java.net.URL; 8 9 import prefuse.data.Graph; 10 11 /** 12 * nterface for classes that read in Graph or Tree data from a particular 13 * file format. 14 * 15 * @author <a HREF="http://jheer.org">jeffrey heer</a> 16 */ 17 public interface GraphReader { 18 19 /** 20 * Read in a graph from the file at the given location. Though 21 * not required by this interface, the String is typically resolved 22 * using the {@link prefuse.util.io.IOLib#streamFromString(String)} method, 23 * allowing URLs, classpath references, and files on the file system 24 * to be accessed. 25 * @param location the location to read the table from 26 * @return the loaded Graph 27 * @throws FileNotFoundException 28 * @throws IOException 29 */ 30 public Graph readGraph(String location) throws DataIOException; 31 32 /** 33 * Read in a graph from the given URL. 34 * @param url the url to read the graph from 35 * @return the loaded Graph 36 * @throws IOException 37 */ 38 public Graph readGraph(URL url) throws DataIOException; 39 40 /** 41 * Read in a graph from the given File. 42 * @param f the file to read the graph from 43 * @return the loaded Graph 44 * @throws FileNotFoundException 45 * @throws IOException 46 */ 47 public Graph readGraph(File f) throws DataIOException; 48 49 /** 50 * Read in a graph from the given InputStream. 51 * @param is the InputStream to read the graph from 52 * @return the loaded Graph 53 * @throws IOException 54 */ 55 public Graph readGraph(InputStream is) throws DataIOException; 56 57 } // end of interface GraphReader 58