Class 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.

    • Method Detail

      • 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 the InputStream returned GetObjectResponse.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 send
        target - 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 by MultithreadStream.

        This does NOT multithread the download.