001    package org.maltparser.core.syntaxgraph.writer;
002    
003    import java.io.OutputStream;
004    import java.io.OutputStreamWriter;
005    
006    import org.maltparser.core.exception.MaltChainedException;
007    import org.maltparser.core.io.dataformat.DataFormatInstance;
008    import org.maltparser.core.syntaxgraph.TokenStructure;
009    /**
010    *
011    *
012    * @author Johan Hall
013    */
014    public interface SyntaxGraphWriter {
015            /**
016             * Opens a file for writing
017             * 
018             * @param fileName      the file name of the file
019             * @param charsetName   the name of the character encoding set 
020             * @throws MaltChainedException
021             */
022            public void open(String fileName, String charsetName) throws MaltChainedException;
023            /**
024             * Opens an output stream
025             * 
026             * @param os an output stream
027             * @param charsetName the name of the character encoding set 
028             * @throws MaltChainedException
029             */
030            public void open(OutputStream os, String charsetName) throws MaltChainedException;
031            /**
032             * Opens an output stream reader
033             * 
034             * @param osw an output stream reader
035             * @throws MaltChainedException
036             */
037            public void open(OutputStreamWriter osw) throws MaltChainedException;
038            /**
039             * Cause the syntax graph writer to write the beginning of the file (such as header information)
040             * 
041             * @throws MaltChainedException
042             */
043            public void writeProlog() throws MaltChainedException;
044            /**
045             * Writes a sentence (token structure, dependency structure or/and phrase structure)
046             * 
047             * @param syntaxGraph a syntax graph (token structure, dependency structure or/and phrase structure)
048             * @throws MaltChainedException
049             */
050            public void writeSentence(TokenStructure syntaxGraph) throws MaltChainedException;
051            /**
052             * Writes the end of the file 
053             * 
054             * @throws MaltChainedException
055             */
056            public void writeEpilog() throws MaltChainedException;
057            /**
058             * Returns the output data format instance
059             * 
060             * @return the output data format instance
061             */
062            public DataFormatInstance getDataFormatInstance();
063            /**
064             * Sets the output data format instance
065             * 
066             * @param dataFormatInstance an output data format instance
067             */
068            public void setDataFormatInstance(DataFormatInstance dataFormatInstance);
069            /**
070             * Returns a string representation of the writer specific options.
071             * 
072             * @return a string representation of the writer specific options.
073             */
074            public String getOptions();
075            /**
076             * Sets the writer specific options.
077             * 
078             * @param optionString a string representation of the writer specific options
079             * @throws MaltChainedException
080             */
081            public void setOptions(String optionString) throws MaltChainedException;
082            /**
083             * Closes the file or the output stream.
084             * 
085             * @throws MaltChainedException
086             */
087            public void close() throws MaltChainedException;
088    }