com.android.repository.testframework
Class FakeDownloader

java.lang.Object
  extended by com.android.repository.testframework.FakeDownloader
All Implemented Interfaces:
Downloader

public class FakeDownloader
extends java.lang.Object
implements Downloader

Fake implementation of Downloader that returns some specified content for specified URLs.


Constructor Summary
FakeDownloader()
           
 
Method Summary
 void dispose()
          Close all input streams, since they will have been prevented from being closed by ReopeningInputStream.
 java.io.InputStream download(java.net.URL url, SettingsController controller, ProgressIndicator indicator)
          Gets a stream associated with the content at the given URL.
 void registerUrl(java.net.URL url, java.io.InputStream stream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FakeDownloader

public FakeDownloader()
Method Detail

registerUrl

public void registerUrl(java.net.URL url,
                        java.io.InputStream stream)

download

@NonNull
public java.io.InputStream download(@NonNull
                                            java.net.URL url,
                                            @NonNull
                                            SettingsController controller,
                                            @NonNull
                                            ProgressIndicator indicator)
                             throws java.io.IOException
Description copied from interface: Downloader
Gets a stream associated with the content at the given URL. This could be achieved by downloading the file completely, streaming it directly, or some combination.

Specified by:
download in interface Downloader
Parameters:
url - The URL to fetch.
controller - Settings (e.g. proxy configuration) for the connection.
indicator - Facility for showing download progress and logging.
Returns:
An InputStream corresponding to the specified content, or null if the download is cancelled.
Throws:
java.io.IOException

dispose

public void dispose()
Close all input streams, since they will have been prevented from being closed by ReopeningInputStream.