001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 * Created on 26.04.2004 021 * @author Andreas Prlic 022 * 023 */ 024package org.biojava.nbio.structure.io; 025 026import org.biojava.nbio.structure.Structure; 027 028import java.io.File; 029import java.io.IOException; 030import java.util.List; 031 032/** 033 * StructureIOFile extends StructureProvider with methods specific to 034 * parsing files from the filesystem. 035 * @author Andreas Prlic 036 */ 037public interface StructureIOFile extends StructureProvider { 038 039 /** 040 * Associates a file extension with this particular StructureIOFile, 041 * indicating that files of that type can be parsed. This is generally 042 * called only in the constructor of the implementing class. 043 * @param ext a String ... 044 */ 045 public void addExtension(String ext); 046 047 /** 048 * Returns a list of extensions supported by this class 049 * @return a (potentially empty) list of strings 050 */ 051 public List<String> getExtensions(); 052 053 /** 054 * Open filename and return a Structure object. 055 * 056 * Not to be confused with {@link #getStructureById(String)} 057 * @param filename The path to the file. Must be the correct format for the 058 * implementing class. 059 * @return a Structure object 060 * @throws IOException ... 061 */ 062 public Structure getStructure(String filename) throws IOException ; 063 064 /** 065 * Read file from File and returns 066 * a Structure object. 067 * @param file file containing the structure. Must be the correct format for 068 * the implementing class 069 * @return a Structure object 070 * @throws IOException ... 071 */ 072 public Structure getStructure(File file) throws IOException ; 073}