Class DownloadResponse


  • public final class DownloadResponse
    extends Object
    DownloadResponse wraps the protocol-layer response from BlobURL.download(BlobRange, BlobAccessConditions, boolean, com.microsoft.rest.v2.Context) to automatically retry failed reads from the body as appropriate. If the download is interrupted, the DownloadResponse will make a request to resume the download from where it left off, allowing the user to consume the data as one continuous stream, for any interruptions are hidden. The retry behavior is defined by the options passed to the body(ReliableDownloadOptions). The download will also lock on the blob's etag to ensure consistency.

    Note that the retries performed as a part of this reader are composed with those of any retries in an HttpPipeline used in conjunction with this reader. That is, if this object issues a request to resume a download, an underlying pipeline may issue several retries as a part of that request. Furthermore, this reader only retries on network errors; timeouts and unexpected status codes are not retried. Therefore, the behavior of this reader is entirely independent of and in no way coupled to an HttpPipeline's retry mechanism.

    • Constructor Detail

      • DownloadResponse

        public DownloadResponse​(com.microsoft.rest.v2.RestResponse<BlobDownloadHeaders,​io.reactivex.Flowable<ByteBuffer>> response,
                                com.microsoft.azure.storage.blob.HTTPGetterInfo info,
                                io.reactivex.functions.Function<com.microsoft.azure.storage.blob.HTTPGetterInfo,​io.reactivex.Single<DownloadResponse>> getter)
    • Method Detail

      • body

        public io.reactivex.Flowable<ByteBuffer> body​(ReliableDownloadOptions options)
        Returns the response body which has been modified to enable reliably reading data if desired (if options.maxRetryRequests > 0. If retries are enabled, if a connection fails while reading, the stream will make additional requests to reestablish a connection and continue reading.
        Parameters:
        options - ReliableDownloadOptions
        Returns:
        A Flowable which emits the data as ByteBuffers.
      • statusCode

        public int statusCode()