/**
   * Gets a result segment containing a collection of queues from the storage service with the
   * specified parameters.
   *
   * @param prefix A <code>String</code> containing the queue name prefix to filter the results
   *     with.
   * @param detailsIncluded A {@link QueueListingDetails} value that indicates whether queue
   *     metadata will be returned.
   * @param maxResults The maximum number of queue results to retrieve.
   * @param continuationToken A {@link ResultContinuation} object that represents a continuation
   *     token returned by a previous listing operation.
   * @param options A {@link QueueRequestOptions} object that specifies any additional options for
   *     the request. Specifying <code>null</code> will use the default request options from the
   *     associated service client ( {@link CloudQueue}).
   * @param taskReference A {@link StorageOperation} reference to the encapsulating task.
   * @param opContext An {@link OperationContext} object that represents the context for the current
   *     operation. This object is used to track requests to the storage service, and to provide
   *     additional runtime information about the operation.
   * @return A {@link ResultSegment} of {@link CloudQueue} objects that contains a segment of the
   *     iterable collection of {@link CloudQueue} objects that represent the requested queues in
   *     the storage service.
   * @throws IOException
   * @throws URISyntaxException If the URI is not valid.
   * @throws XMLStreamException
   * @throws InvalidKeyException
   * @throws StorageException If a storage service error occurred during the operation.
   */
  @DoesServiceRequest
  ResultSegment<CloudQueue> listQueuesCore(
      final String prefix,
      final QueueListingDetails detailsIncluded,
      final int maxResults,
      final ResultContinuation continuationToken,
      final RequestOptions options,
      final StorageOperation<CloudQueueClient, Void, ResultSegment<CloudQueue>> taskReference,
      final OperationContext opContext)
      throws IOException, URISyntaxException, XMLStreamException, InvalidKeyException,
          StorageException {

    Utility.assertContinuationType(continuationToken, ResultContinuationType.QUEUE);

    final ListingContext listingContext = new ListingContext(prefix, maxResults);
    listingContext.setMarker(continuationToken != null ? continuationToken.getNextMarker() : null);

    final HttpURLConnection listQueueRequest =
        QueueRequest.list(
            this.getEndpoint(),
            options.getTimeoutIntervalInMs(),
            listingContext,
            detailsIncluded,
            opContext);

    this.getCredentials().signRequest(listQueueRequest, -1L);

    taskReference.setResult(ExecutionEngine.processRequest(listQueueRequest, opContext));

    if (taskReference.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) {
      taskReference.setNonExceptionedRetryableFailure(true);
      return null;
    }

    final ListQueuesResponse response = new ListQueuesResponse(listQueueRequest.getInputStream());
    response.parseResponse(this);

    ResultContinuation newToken = null;

    if (response.getNextMarker() != null) {
      newToken = new ResultContinuation();
      newToken.setNextMarker(response.getNextMarker());
      newToken.setContinuationType(ResultContinuationType.QUEUE);
    }

    final ResultSegment<CloudQueue> resSegment =
        new ResultSegment<CloudQueue>(response.getQueues(this), maxResults, newToken);

    return resSegment;
  }