com.android.repository.api
Interface Downloader

All Known Implementing Classes:
FakeDownloader

public interface Downloader

Implementations provide a general mechanism for downloading files.


Method Summary
 java.io.InputStream downloadAndStream(java.net.URL url, SettingsController settings, ProgressIndicator indicator)
          Gets a stream associated with the content at the given URL.
 java.io.File downloadFully(java.net.URL url, SettingsController settings, ProgressIndicator indicator)
          Downloads the content at the given URL to a temporary file and returns a handle to that file.
 

Method Detail

downloadAndStream

@Nullable
java.io.InputStream downloadAndStream(@NonNull
                                               java.net.URL url,
                                               @Nullable
                                               SettingsController settings,
                                               @NonNull
                                               ProgressIndicator indicator)
                                      throws java.io.IOException
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.

Parameters:
url - The URL to fetch.
settings - 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
java.io.File downloadFully(@NonNull
                                    java.net.URL url,
                                    @Nullable
                                    SettingsController settings,
                                    @NonNull
                                    ProgressIndicator indicator)
                           throws java.io.IOException
Downloads the content at the given URL to a temporary file and returns a handle to that file.

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