Class DownloadManager
- java.lang.Object
-
- com.oracle.bmc.objectstorage.transfer.DownloadManager
-
public class DownloadManager extends Object
Download manager, which automatically breaks a larger download into parallel downloads, based on object size.It also handles possible retries.
The retries in the download manager are smarter than the retries built into the client: The download manager modifies the request to only retry the parts that haven't been read yet. The client would retry the entire request, and re-download parts that have already been downloaded.
Since these retries have been implemented independent of the regular client retries, client retries set using
RetryConfiguration
are ignored.
-
-
Constructor Summary
Constructors Constructor Description DownloadManager(ObjectStorage objectStorage, DownloadConfiguration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GetObjectResponse
downloadObjectToFile(GetObjectRequest request, File target)
Download the object and save it to a file.GetObjectResponse
getObject(GetObjectRequest request)
This calls acts just likeObjectStorage.getObject(GetObjectRequest)
except that theInputStream
returnedGetObjectResponse.getInputStream()
will automatically retry the get operation if there is failure.GetObjectResponse
getObject_singleThreaded(GetObjectRequest request)
Used byMultithreadStream
.
-
-
-
Constructor Detail
-
DownloadManager
@ConstructorProperties({"objectStorage","config"}) public DownloadManager(ObjectStorage objectStorage, DownloadConfiguration config)
-
-
Method Detail
-
getObject
public GetObjectResponse getObject(GetObjectRequest request)
This calls acts just likeObjectStorage.getObject(GetObjectRequest)
except that theInputStream
returnedGetObjectResponse.getInputStream()
will automatically retry the get operation if there is failure.These retries introduce a new set of possible failures. If the object is modified during a get operation a retry can fail with a 412 or 404 status code.
- Parameters:
request
- The request object containing the details to send- Returns:
- A response object containing details about the completed operation
- Throws:
BmcException
- when an error occurs.
-
downloadObjectToFile
public GetObjectResponse downloadObjectToFile(GetObjectRequest request, File target) throws IOException
Download the object and save it to a file.This calls acts just like
ObjectStorage.getObject(GetObjectRequest)
except that theInputStream
returnedGetObjectResponse.getInputStream()
will automatically retry the get operation if there is failure.These retries introduce a new set of possible failures. If the object is modified during a get operation a retry can fail with a 412 or 404 status code.
The downloaded object will be saved in the specified file.
The response will be returned, but note that the stream has already been consumed.
- Parameters:
request
- The request object containing the details to sendtarget
- The file where the object should be saved- Returns:
- A response object containing details about the completed operation, but with already consumed stream
- Throws:
BmcException
- when an error occurs.IOException
-
getObject_singleThreaded
public GetObjectResponse getObject_singleThreaded(GetObjectRequest request)
Used byMultithreadStream
.This does NOT multithread the download.
-
-