001    package edu.nrao.sss.astronomy;
002    
003    import java.io.IOException;
004    import java.io.InputStream;
005    
006    /**
007     * A reader that can create or fill an ephemeris table from
008     * data in a file.
009     * <p>
010     * <b>CVS Info:</b>
011     * <table style="margin-left:2em">
012     *   <tr><td>$Revision: 161 $</td></tr>
013     *   <tr><td>$Date: 2006-12-15 11:48:34 -0700 (Fri, 15 Dec 2006) $</td></tr>
014     *   <tr><td>$Author: btruitt $</td></tr>
015     * </table></p>
016     *  
017     * @author David M. Harland
018     * @since  2006-06-12
019     */
020    public interface EphemerisTableReader
021    {
022      /**
023       * Creates an ephemeris table from the data found in the given file.
024       * 
025       * @param fileName the name of the file that has the ephemeris data.
026       * 
027       * @return a new ephemeris table based on the data in the given file.
028       * 
029       * @throws IOException if anything does wrong while reading the file.
030       */
031      public EphemerisTable read(String fileName) throws IOException;
032    
033      /**
034       * Appends the data found in the given file to {@code destination} and
035       * returns it.
036       * If {@code destination} is <i>null</i>, a new table is created, filled,
037       * and returned. 
038       * 
039       * @param fileName the name of the file that has the ephemeris data.
040       * 
041       * @return {@code destination}, or a new table if destination is <i>null</i>,
042       *         with the data from {@code fileName} appended to it.
043       * 
044       * @throws IOException if anything does wrong while reading the file.
045       */
046      public EphemerisTable read(String fileName, EphemerisTable destination)
047        throws IOException;
048      
049      /**
050       * Creates an ephemeris table from the data found in the given input stream.
051       * 
052       * @param in a stream that contains ephemeris data.
053       * 
054       * @return a new ephemeris table based on the data in the given stream.
055       * 
056       * @throws IOException if anything does wrong while reading the stream.
057       */
058      public EphemerisTable read(InputStream in) throws IOException;
059    
060      /**
061       * Appends the data found in the given stream to {@code destination} and
062       * returns it.
063       * If {@code destination} is <i>null</i>, a new table is created, filled,
064       * and returned. 
065       * 
066       * @param in a stream that contains ephemeris data.
067       * 
068       * @return {@code destination}, or a new table if destination is <i>null</i>,
069       *         with the data from {@code in} appended to it.
070       *         
071       * @throws IOException if anything does wrong while reading the file.
072       */
073      public EphemerisTable read(InputStream in, EphemerisTable destination)
074        throws IOException;
075    }