com.android.repository.testframework
Class FakeDownloader
java.lang.Object
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.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FakeDownloader
public FakeDownloader(MockFileOp fop)
registerUrl
public void registerUrl(java.net.URL url,
byte[] data)
registerUrl
public void registerUrl(java.net.URL url,
java.io.InputStream content)
throws java.io.IOException
- Throws:
java.io.IOException
getFileName
@NonNull
public java.lang.String getFileName(java.net.URL url)
downloadAndStream
@NonNull
public java.io.InputStream downloadAndStream(@NonNull
java.net.URL url,
@Nullable
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:
downloadAndStream 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
downloadFully
@Nullable
public java.io.File downloadFully(@NonNull
java.net.URL url,
@Nullable
SettingsController settings,
@NonNull
ProgressIndicator indicator)
throws java.io.IOException
- Description copied from interface:
Downloader
- Downloads the content at the given URL to a temporary file and returns a handle to that file.
- Specified by:
downloadFully in interface Downloader
- Parameters:
url - The URL to fetch.settings - Settings (e.g. proxy configuration) for the connection.indicator - Facility for showing download progress and logging.
- Returns:
- The temporary file, or
null if the download is cancelled.
- Throws:
java.io.IOException