updater.downloaders
Class Downloader

java.lang.Object
  extended by updater.downloaders.Downloader
All Implemented Interfaces:
IDownloader

public class Downloader
extends Object
implements IDownloader

Implements the IDownloader interface using a URLConnection.


Constructor Summary
Downloader()
          Creates a new instance of Downloader
 
Method Summary
 void download(String url, File localFile)
           
 String downloadAsString(String url)
          Returns the contents of as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Downloader

public Downloader()
Creates a new instance of Downloader

Method Detail

download

public void download(String url,
                     File localFile)
              throws FileNotFoundException,
                     MalformedURLException,
                     IOException
Specified by:
download in interface IDownloader
Parameters:
url - A string specifying the URL of the remote file to download.
localFile - The path of the local file to save the remote file to.
Throws:
FileNotFoundException - If localFile cannot be created.
MalformedURLException - If url is a malformed URL.
IOException - If the remote file cannot be downloaded.

downloadAsString

public String downloadAsString(String url)
                        throws IOException
Description copied from interface: IDownloader
Returns the contents of as a String.

Specified by:
downloadAsString in interface IDownloader
Parameters:
url - A string specifying the URL of the remote file to download.
Returns:
The contents of url as a String.
Throws:
IOException - If the remote file cannot be downloaded.