com.aliyun.oss.model

## 类 GetObjectRequest

- java.lang.Object
- - com.aliyun.oss.model.WebServiceRequest
  - - com.aliyun.oss.model.GenericRequest
    - - com.aliyun.oss.model.GetObjectRequest

- 直接已知子类:
    SelectObjectRequest

      public class GetObjectRequest
      extends GenericRequest

  This is the request class that is used to download an object from OSS. It wraps all the information needed to download an object.

- - ### 字段概要

    - ### 从类继承的字段 com.aliyun.oss.model.WebServiceRequest

      `NOOP`

  - ### 构造器概要

    构造器
    构造器和说明
    `GetObjectRequest(String bucketName, String key)` Constructs a new `GetObjectRequest` with all the required parameters.
    `GetObjectRequest(String bucketName, String key, String versionId)` Constructs a new `GetObjectRequest` with all the required parameters.
    `GetObjectRequest(URL absoluteUrl, Map<String,String> requestHeaders)` Constructor with presigned Url and user's custom headers.

  - ### 方法概要

    方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `clearMatchingETagConstraints()`
    `void` | `clearNonmatchingETagConstraints()`
    `URL` | `getAbsoluteUri()`
    `List<String>` | `getMatchingETagConstraints()` Gets the matching Etag constraints.
    `Date` | `getModifiedSinceConstraint()` Gets the modified since constraints.
    `List<String>` | `getNonmatchingETagConstraints()` Gets the non-matching Etag constraints.
    `String` | `getProcess()`
    `long[]` | `getRange()` Gets the range of the object to download.
    `ResponseHeaderOverrides` | `getResponseHeaders()` Gets the response headers to override.
    `int` | `getTrafficLimit()` Gets traffic limit speed, its unit is bit/s
    `Date` | `getUnmodifiedSinceConstraint()` Gets the unmodified since constraints.
    `boolean` | `isUseUrlSignature()`
    `void` | `setAbsoluteUri(URL absoluteUri)`
    `void` | `setMatchingETagConstraints(List<String> eTagList)` Sets the matching Etag constraints.
    `void` | `setModifiedSinceConstraint(Date date)` Sets the modified since constraints.
    `void` | `setNonmatchingETagConstraints(List<String> eTagList)` Sets the non-matching Etag constraints.
    `void` | `setProcess(String process)`
    `void` | `setRange(long start, long end)` Sets the range of the object to download (optional).
    `void` | `setResponseHeaders(ResponseHeaderOverrides responseHeaders)` Sets the response headers to override (optional).
    `void` | `setTrafficLimit(int trafficLimit)` Sets traffic limit speed, its unit is bit/s
    `void` | `setUnmodifiedSinceConstraint(Date date)` Sets the unmodified since constraints.
    `void` | `setUseUrlSignature(boolean useUrlSignature)`
    `GetObjectRequest` | `withRange(long start, long end)` Sets the range of the object to download and return current GetObjectRequest instance (this).

    - ### 从类继承的方法 com.aliyun.oss.model.GenericRequest

      `getBucketName, getKey, getRequestPayer, getVersionId, setBucketName, setKey, setRequestPayer, setVersionId, withBucketName, withKey, withRequestPayer, withVersionId`

    - ### 从类继承的方法 com.aliyun.oss.model.WebServiceRequest

      `addAdditionalHeaderName, addHeader, addParameter, getAdditionalHeaderNames, getHeaders, getParameters, getProgressListener, isLogEnabled, setAdditionalHeaderNames, setHeaders, setLogEnabled, setParameters, setProgressListener, withProgressListener`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### GetObjectRequest

          public GetObjectRequest(String bucketName,
                          String key)

      Constructs a new `GetObjectRequest` with all the required parameters.
      参数:
        `bucketName` - The name of the bucket containing the desired object.
        `key` - The key in the specified bucket under which the object is stored.

    - #### GetObjectRequest

          public GetObjectRequest(String bucketName,
                          String key,
                          String versionId)

      Constructs a new `GetObjectRequest` with all the required parameters.
      参数:
        `bucketName` - The name of the bucket containing the desired object.
        `key` - The key in the specified bucket under which the object is stored.
        `versionId` - The OSS version ID specifying a specific version of the object to download.

    - #### GetObjectRequest

          public GetObjectRequest(URL absoluteUrl,
                          Map<String,String> requestHeaders)

      Constructor with presigned Url and user's custom headers.
      参数:
        `absoluteUrl` - Signed url.
        `requestHeaders` - Request headers.

  - ### 方法详细资料

    - #### getRange

          public long[] getRange()

      Gets the range of the object to download. The range is in the form of {start, end}---start and end is position of the object's content.
      返回:
        The range of the object to download.

    - #### setRange

          public void setRange(long start,
                      long end)

      Sets the range of the object to download (optional).
      参数:
        `start` -

        Start position

        When the start is non-negative, it means the starting position to download. When the start is -1, it means the range is determined by the end only and the end could not be -1. For example, when start is -1 and end is 100. It means the download range will be the last 100 bytes.

        `end` -

        End position

        When the end is non-negative, it means the ending position to download. When the end is -1, it means the range is determined by the start only and the start could not be -1. For example, when end is -1 and start is 100. It means the download range will be all exception first 100 bytes.

    - #### withRange

          public GetObjectRequest withRange(long start,
                                   long end)

      Sets the range of the object to download and return current GetObjectRequest instance (this).
      参数:
        `start` -

        Start position

        When the start is non-negative, it means the starting position to download. When the start is -1, it means the range is determined by the end only and the end could not be -1. For example, when start is -1 and end is 100. It means the download range will be the last 100 bytes.

        `end` -

        End position

        When the end is non-negative, it means the ending position to download. When the end is -1, it means the range is determined by the start only and the start could not be -1. For example, when end is -1 and start is 100. It means the download range will be all exception first 100 bytes.

    - #### getMatchingETagConstraints

          public List<String> getMatchingETagConstraints()

      Gets the matching Etag constraints. If the first ETag returned matches the object's ETag, the file would be downloaded. Currently OSS only supports one ETag. Otherwise, return precondition failure (412).
      返回:
        The list of expected ETags.

    - #### setMatchingETagConstraints

          public void setMatchingETagConstraints(List<String> eTagList)

      Sets the matching Etag constraints. If the first ETag returned matches the object's ETag, the file would be downloaded. Otherwise, return precondition failure (412).
      参数:
        `eTagList` - The expected ETag list. OSS only supports one ETag.

    - #### clearMatchingETagConstraints

          public void clearMatchingETagConstraints()

    - #### getNonmatchingETagConstraints

          public List<String> getNonmatchingETagConstraints()

      Gets the non-matching Etag constraints. If the first ETag returned does not match the object's ETag, the file would be downloaded. Currently OSS only supports one ETag. Otherwise, return precondition failure (412).
      返回:
        The list of expected ETags (only the first one matters though).

    - #### setNonmatchingETagConstraints

          public void setNonmatchingETagConstraints(List<String> eTagList)

      Sets the non-matching Etag constraints. If the first ETag returned does not match the object's ETag, the file would be downloaded. Currently OSS only supports one ETag. Otherwise, returns precondition failure (412).
      参数:
        `eTagList` - The list of expected ETags (only the first one matters though).

    - #### clearNonmatchingETagConstraints

          public void clearNonmatchingETagConstraints()

    - #### getUnmodifiedSinceConstraint

          public Date getUnmodifiedSinceConstraint()

      Gets the unmodified since constraints. If the timestamp returned is equal or later than the actual file's modified time, the file would be downloaded. Otherwise, the download API returns precondition failure (412).
      返回:
        The timestamp.

    - #### setUnmodifiedSinceConstraint

          public void setUnmodifiedSinceConstraint(Date date)

      Sets the unmodified since constraints. If the timestamp specified in date parameter is equal or later than the actual file's modified time, the file would be downloaded. Otherwise, the download API returns precondition failure (412).
      参数:
        `date` - The timestamp.

    - #### getModifiedSinceConstraint

          public Date getModifiedSinceConstraint()

      Gets the modified since constraints. If the timestamp returned is earlier than the actual file's modified time, the file would be downloaded. Otherwise, the download API returns precondition failure (412).
      返回:
        “If-Modified-Since” timestamp.

    - #### setModifiedSinceConstraint

          public void setModifiedSinceConstraint(Date date)

      Sets the modified since constraints. If the timestamp returned is earlier than the actual file's modified time, the file would be downloaded. Otherwise, the download API returns precondition failure (412).
      参数:
        `date` - “If-Modified-Since” parameter.

    - #### getResponseHeaders

          public ResponseHeaderOverrides getResponseHeaders()

      Gets the response headers to override.
      返回:
        The response headers to override.

    - #### setResponseHeaders

          public void setResponseHeaders(ResponseHeaderOverrides responseHeaders)

      Sets the response headers to override (optional).
      参数:
        `responseHeaders` - The response headers to override.

    - #### getAbsoluteUri

          public URL getAbsoluteUri()

    - #### setAbsoluteUri

          public void setAbsoluteUri(URL absoluteUri)

    - #### isUseUrlSignature

          public boolean isUseUrlSignature()

    - #### setUseUrlSignature

          public void setUseUrlSignature(boolean useUrlSignature)

    - #### getProcess

          public String getProcess()

    - #### setProcess

          public void setProcess(String process)

    - #### setTrafficLimit

          public void setTrafficLimit(int trafficLimit)

      Sets traffic limit speed, its unit is bit/s

    - #### getTrafficLimit

          public int getTrafficLimit()

      Gets traffic limit speed, its unit is bit/s
      返回:
        traffic limit speed

Copyright © 2020. All Rights Reserved.