001    package updater.downloaders;
002    
003    import java.io.File;
004    import java.io.FileNotFoundException;
005    import java.io.IOException;
006    import java.net.MalformedURLException;
007    
008    /**
009     * Manages downloading of files via HTTP.
010     */ 
011    public interface IDownloader {
012        
013            /**
014             * 
015             * @param url A string specifying the URL of the remote file to download.
016             * @param localFile The path of the local file to save the remote file to.
017             * @throws IOException If the remote file cannot be downloaded.
018             * @throws FileNotFoundException If <tt>localFile</tt> cannot be created.
019             * @throws MalformedURLException If <tt>url</tt> is a malformed URL.
020             * 
021             * @requires All parameters are non-null.
022             * 
023             * @effects Downloads the file at <tt>url</tt> and saves its contents
024             * to file <tt>localFile</tt>, overwriting the file if already present.
025             */
026        public void download(String url, File localFile)
027        throws IOException, FileNotFoundException, MalformedURLException;
028        
029        /**
030         * Returns the contents of  as a String.
031         * 
032         * @param url A string specifying the URL of the remote file to download.
033         * @throws IOException If the remote file cannot be downloaded.
034         * @returns A string with the contents of the remote file.
035         * 
036         * @requires <tt>url</tt> is non-null.
037         * @effects Downloads the file at <tt></tt> and returns its contents
038         *          as a String.
039         * @return The contents of <tt>url</tt> as a String.
040         */
041        public String downloadAsString(String url) throws IOException;
042    }