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 at Mar 4, 2008 021 */ 022package org.biojava.nbio.structure.io.mmcif; 023 024import java.io.BufferedReader; 025import java.io.IOException; 026import java.io.InputStream; 027 028/** Interface that needs to be implemented by an MMcifParser 029 * 030 * @author Andreas Prlic 031 * @since 1.7 032 */ 033public interface MMcifParser { 034 035 /** Add a MMcifConsumer that listens to even being triggered by the parser and processes the data into a backend provided by the Consumer. 036 * 037 * @param consumer a consumer object. 038 */ 039 public void addMMcifConsumer(MMcifConsumer consumer); 040 041 /** Remove all consumers from the parser. 042 * 043 */ 044 public void clearConsumers(); 045 046 /** remove a single consumer from the parser 047 * 048 * @param consumer 049 */ 050 public void removeMMcifConsumer(MMcifConsumer consumer); 051 052 053 /** Start the actual parsing. The parser will trigger events that are defined by the MMcifConsumer class. 054 * 055 * @param buf a BufferedReader. 056 */ 057 public void parse(BufferedReader buf) throws IOException; 058 059 /** Start the actual parsing. The parser will trigger events that are defined by the MMcifConsumer class. 060 * 061 * @param inStream InputStream to parse from. 062 */ 063 public void parse(InputStream inStream) throws IOException; 064 065 066}