001 // GraphLab Project: http://graphlab.sharif.edu 002 // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology 003 // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/ 004 package graphlab.plugins.main.saveload.core; 005 006 import graphlab.graph.graph.GraphModel; 007 008 import java.io.File; 009 import java.io.IOException; 010 011 /** 012 * @author azin azadi 013 014 */ 015 public interface GraphReaderInterface { 016 /** 017 * Reads the file and enters the data in the graph. The method gets an 018 * empty graph object, and initializes it with the data from the file. 019 * 020 * @param file the file 021 * @return boolean Indicates whether the file is acceptable for reading. 022 */ 023 boolean accepts(File file); 024 025 /** 026 * Retrieves the name of the file type. 027 * 028 * @return the Name 029 */ 030 public String getName(); 031 032 /** 033 * Retrieves the file extension for the file type. Example: "xml", "gr". 034 * 035 * @return the Extension 036 */ 037 public String getExtension(); 038 039 /** 040 * Reads the file and enters the data in the graph. The method gets an empty graph, 041 * and initializes it with the data from the file. 042 * 043 * @param file 044 * @throws GraphIOException In the case of the reader error. 045 * @throws IOException - In the case of the IO error. 046 */ 047 public GraphModel read(File file) throws GraphIOException; 048 }