/**
   * Returns a result segment of an enumerable collection of files and directories for this
   * directory, using the specified listing details options, request options, and operation context.
   *
   * @param maxResults The maximum number of results to retrieve.
   * @param continuationToken A {@link ResultContinuation} object that represents a continuation
   *     token returned by a previous listing operation.
   * @param options A {@link FileRequestOptions} 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 CloudFileClient}).
   * @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} object that contains a segment of the enumerable collection of
   *     {@link ListFileItem} objects that represent the files and directories in this directory.
   * @throws StorageException If a storage service error occurred.
   */
  public ResultSegment<ListFileItem> listFilesAndDirectoriesSegmented(
      final int maxResults,
      final ResultContinuation continuationToken,
      FileRequestOptions options,
      OperationContext opContext)
      throws StorageException {
    if (opContext == null) {
      opContext = new OperationContext();
    }

    opContext.initialize();
    options = FileRequestOptions.applyDefaults(options, this.fileServiceClient);

    Utility.assertContinuationType(continuationToken, ResultContinuationType.FILE);

    SegmentedStorageRequest segmentedRequest = new SegmentedStorageRequest();
    segmentedRequest.setToken(continuationToken);

    return ExecutionEngine.executeWithRetry(
        this.fileServiceClient,
        this,
        this.listFilesAndDirectoriesSegmentedImpl(maxResults, options, segmentedRequest),
        options.getRetryPolicyFactory(),
        opContext);
  }
  /**
   * Creates the directory using the specified options and operation context.
   *
   * @param options A {@link FileRequestOptions} 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 CloudFileClient}).
   * @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.
   * @throws StorageException If a storage service error occurred.
   */
  @DoesServiceRequest
  public void create(FileRequestOptions options, OperationContext opContext)
      throws StorageException {
    if (opContext == null) {
      opContext = new OperationContext();
    }

    opContext.initialize();
    options = FileRequestOptions.applyDefaults(options, this.fileServiceClient);

    ExecutionEngine.executeWithRetry(
        this.fileServiceClient,
        this,
        createDirectoryImpl(options),
        options.getRetryPolicyFactory(),
        opContext);
  }
  /**
   * Downloads the directory's properties using the specified request options and operation context.
   *
   * @param accessCondition An {@link AccessCondition} object that represents the access conditions
   *     for the directory.
   * @param options A {@link FileRequestOptions} 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 CloudFileClient}).
   * @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.
   * @throws StorageException If a storage service error occurred.
   */
  @DoesServiceRequest
  public void downloadAttributes(
      AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext)
      throws StorageException {
    if (opContext == null) {
      opContext = new OperationContext();
    }

    opContext.initialize();
    options = FileRequestOptions.applyDefaults(options, this.fileServiceClient);

    ExecutionEngine.executeWithRetry(
        this.fileServiceClient,
        this,
        this.downloadAttributesImpl(accessCondition, options),
        options.getRetryPolicyFactory(),
        opContext);
  }
  @DoesServiceRequest
  private boolean exists(
      final boolean primaryOnly,
      final AccessCondition accessCondition,
      FileRequestOptions options,
      OperationContext opContext)
      throws StorageException {
    if (opContext == null) {
      opContext = new OperationContext();
    }

    opContext.initialize();
    options = FileRequestOptions.applyDefaults(options, this.fileServiceClient);

    return ExecutionEngine.executeWithRetry(
        this.fileServiceClient,
        this,
        this.existsImpl(primaryOnly, accessCondition, options),
        options.getRetryPolicyFactory(),
        opContext);
  }