Class CloudStorageOptions

java.lang.Object
com.google.cloud.storage.contrib.nio.CloudStorageOptions

public final class CloudStorageOptions extends Object
Helper class for specifying options when opening and copying Cloud Storage files.
  • Method Details

    • withMimeType

      public static CloudStorageOption.OpenCopy withMimeType(String mimeType)
      Sets the mime type header on an object, e.g. "text/plain".
    • withoutCaching

      public static CloudStorageOption.OpenCopy withoutCaching()
      Disables caching on an object. Same as: withCacheControl("no-cache").
    • withCacheControl

      public static CloudStorageOption.OpenCopy withCacheControl(String cacheControl)
      Sets the Cache-Control HTTP header on an object.
      See Also:
      • "https://developers.google.com/storage/docs/reference-headers#cachecontrol"
    • withContentDisposition

      public static CloudStorageOption.OpenCopy withContentDisposition(String contentDisposition)
      Sets the Content-Disposition HTTP header on an object.
      See Also:
      • "https://developers.google.com/storage/docs/reference-headers#contentdisposition"
    • withContentEncoding

      public static CloudStorageOption.OpenCopy withContentEncoding(String contentEncoding)
      Sets the Content-Encoding HTTP header on an object.
      See Also:
      • "https://developers.google.com/storage/docs/reference-headers#contentencoding"
    • withAcl

      public static CloudStorageOption.OpenCopy withAcl(com.google.cloud.storage.Acl acl)
      Sets the ACL value on a Cloud Storage object.
      See Also:
      • "https://developers.google.com/storage/docs/reference-headers#acl"
    • withUserMetadata

      public static CloudStorageOption.OpenCopy withUserMetadata(String key, String value)
      Sets an unmodifiable piece of user metadata on a Cloud Storage object.
      See Also:
      • "https://developers.google.com/storage/docs/reference-headers#xgoogmeta"
    • withBlockSize

      public static CloudStorageOption.OpenCopy withBlockSize(int size)
      Sets the block size (in bytes) when talking to the Google Cloud Storage server.

      The default is 2097152.

    • withChannelReopen

      public static CloudStorageOption.OpenCopy withChannelReopen(int count)
      Sets the max number of times that the channel can be reopened if reading fails because the channel unexpectedly closes.

      The default is 0.