Package org.gbif.api.service.occurrence
Interface DownloadRequestService
-
public interface DownloadRequestService
Provides services to manage download requests and retrieve the download file. The services provided are:- request inits a new download and assigns it a key *
- cancel cancels an existing download
- getResult retrieves the download file stream, if it is ready
- getResultFile retrieves the download file, if it is ready
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cancel(@NotNull String downloadKey)
Cancels running download.String
create(@NotNull DownloadRequest downloadRequest, String source)
Creates a download request.InputStream
getResult(String downloadKey)
File
getResultFile(String downloadKey)
File
getResultFile(Download download)
-
-
-
Method Detail
-
cancel
void cancel(@NotNull @NotNull String downloadKey)
Cancels running download. If the download is not running throws an IllegalStateException.
-
create
String create(@NotNull @NotNull DownloadRequest downloadRequest, @Nullable String source)
Creates a download request. If the request is successfully created its key is returned.
-
getResult
@Nullable InputStream getResult(String downloadKey)
- Parameters:
downloadKey
- of the corresponding download request- Returns:
- the input stream of the zipped download result file or null if it's not existing or ready yet
-
getResultFile
@Nullable File getResultFile(String downloadKey)
- Parameters:
downloadKey
- of the corresponding download request- Returns:
- the zipped download result file or null if it's not existing or ready yet
-
getResultFile
@Nullable File getResultFile(Download download)
- Parameters:
download
- of the corresponding download request- Returns:
- the zipped download result file or null if it's not existing or ready yet
-
-