@Singleton public class DownloadManager extends Object
| Constructor and Description |
|---|
DownloadManager() |
DownloadManager(Path tempDir) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupExpired()
Cleanup expired downloads.
|
Download |
createDataSourceDownload(DataSource ds,
String name)
Create download to a given local path.
|
Download |
createTemporaryFile(String mediaType,
String name)
Create a temporary file for download.
|
Download |
get(UUID id)
Retrieve a download for the given id.
|
void |
setTempDirectory(Path dir)
Set the directory where temporary downloads will be
created and stored before they expire.
|
public DownloadManager()
public DownloadManager(Path tempDir) throws IOException
IOExceptionpublic void setTempDirectory(Path dir) throws IOException
dir - path to store temporary download filesIOException - IO error because directories could not be createdpublic Download get(UUID id) throws IOException
null.id - id for the download to be retrievednull if not found or expiredIOException - IO errorpublic Download createDataSourceDownload(DataSource ds, String name)
ds - data source for downloadname - optional name for downloadpublic Download createTemporaryFile(String mediaType, String name) throws IOException
mediaType - media type for the downloadname - optional file name for the download, null to omitIOException - IO errorpublic void cleanupExpired()
throws IOException
IOException - io errorCopyright © 2014–2019 Uniklinik RWTH Aachen. All rights reserved.