public class FakeDownloader extends java.lang.Object implements Downloader
Downloader that returns some specified content for specified
URLs.| Constructor and Description |
|---|
FakeDownloader(MockFileOp fop) |
| Modifier and Type | Method and Description |
|---|---|
java.io.InputStream |
downloadAndStream(java.net.URL url,
ProgressIndicator indicator)
Gets a stream associated with the content at the given URL.
|
void |
downloadFully(java.net.URL url,
java.io.File target,
java.lang.String checksum,
ProgressIndicator indicator)
Downloads the content at the given URL to the given file.
|
java.io.File |
downloadFully(java.net.URL url,
ProgressIndicator indicator)
Downloads the content at the given URL to a temporary file and returns a handle to that file.
|
java.lang.String |
getFileName(java.net.URL url) |
void |
registerUrl(java.net.URL url,
byte[] data) |
void |
registerUrl(java.net.URL url,
java.io.InputStream content) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithashpublic FakeDownloader(MockFileOp fop)
public void registerUrl(java.net.URL url,
byte[] data)
public void registerUrl(java.net.URL url,
java.io.InputStream content)
throws java.io.IOException
java.io.IOException@NonNull public java.lang.String getFileName(java.net.URL url)
@NonNull
public java.io.InputStream downloadAndStream(@NonNull
java.net.URL url,
@NonNull
ProgressIndicator indicator)
throws java.io.IOException
DownloaderdownloadAndStream in interface Downloaderurl - The URL to fetch.indicator - Facility for showing download progress and logging.null if the
download is cancelled.java.io.IOException@Nullable
public java.io.File downloadFully(@NonNull
java.net.URL url,
@NonNull
ProgressIndicator indicator)
throws java.io.IOException
DownloaderdownloadFully in interface Downloaderurl - The URL to fetch.indicator - Facility for showing download progress and logging.null if the download is cancelled.java.io.IOExceptionpublic void downloadFully(@NonNull
java.net.URL url,
@NonNull
java.io.File target,
@Nullable
java.lang.String checksum,
@NonNull
ProgressIndicator indicator)
throws java.io.IOException
DownloaderdownloadFully in interface Downloaderurl - The URL to fetch.target - The location to download to.checksum - If specified, first check target to see if the given checksum
matches the existing file. If so, returns immediately.indicator - Facility for showing download progress and logging.java.io.IOException