multipart.downloaders
Class CannedDownloaderStub

java.lang.Object
  extended by multipart.downloaders.CannedDownloaderStub
All Implemented Interfaces:
IDownloader

public class CannedDownloaderStub
extends java.lang.Object
implements IDownloader

Stubbed downloader for testing. Always returns a particular response, namely "--", regardless of the actual URL content.


Constructor Summary
CannedDownloaderStub()
          Creates a new instance of CannedDownloaderStub.
 
Method Summary
 void download(java.lang.String url, java.io.OutputStream dest)
          Regardless of url, writes response to dest
 java.lang.String downloadAsString(java.lang.String url)
          Returns the contents of url as a String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CannedDownloaderStub

public CannedDownloaderStub()
Creates a new instance of CannedDownloaderStub.

Method Detail

download

public void download(java.lang.String url,
                     java.io.OutputStream dest)
              throws java.io.IOException
Regardless of url, writes response to dest

Specified by:
download in interface IDownloader
Parameters:
url - A string specifying the URL of the remote file to download.
dest - The output destination for the downloaded data.
Throws:
java.io.IOException - If the remote file cannot be downloaded.
java.net.MalformedURLException - If url is a malformed URL.

downloadAsString

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

Specified by:
downloadAsString in interface IDownloader
Parameters:
url - A string specifying the URL of the remote file to download.
Returns:
response