StorageMetadata

public classStorageMetadata


Metadata for aStorageReference. Metadata stores default attributes such as size and content type. You may also store custom metadata key value pairs. Metadata values may be used to authorize operations using declarative validation rules.

Summary

Nested types

Creates a StorageMetadata object.

Public constructors

Creates aStorageMetadata object to hold metadata for aStorageReference

Public constructors

StorageMetadata

public StorageMetadata()

Creates aStorageMetadata object to hold metadata for aStorageReference

Public methods

getBucket

public @NullableString getBucket()
Returns
@NullableString

the owning Google Cloud Storage bucket for theStorageReference

getCacheControl

public @NullableString getCacheControl()
Returns
@NullableString

the Cache Control setting of theStorageReference

getContentDisposition

public @NullableString getContentDisposition()
Returns
@NullableString

the content disposition of theStorageReference

getContentEncoding

public @NullableString getContentEncoding()
Returns
@NullableString

the content encoding for theStorageReference

getContentLanguage

public @NullableString getContentLanguage()
Returns
@NullableString

the content language for theStorageReference

getContentType

public @NullableString getContentType()
Returns
@NullableString

the content type of theStorageReference.

getCreationTimeMillis

public long getCreationTimeMillis()
Returns
long

the time theStorageReference was created.

getCustomMetadata

public @NullableString getCustomMetadata(@NonNullString key)

Returns custom metadata for aStorageReference

Parameters
@NonNullString key

The key for which the metadata should be returned

Returns
@NullableString

the metadata stored in the object the given key.

getCustomMetadataKeys

public @NonNullSet<StringgetCustomMetadataKeys()
Returns
@NonNullSet<String>

the keys for custom metadata.

getGeneration

public @NullableString getGeneration()
Returns
@NullableString

a version String indicating what version of theStorageReference

getMd5Hash

public @NullableString getMd5Hash()
Returns
@NullableString

the MD5Hash of theStorageReference object

getMetadataGeneration

public @NullableString getMetadataGeneration()
Returns
@NullableString

a version String indicating the version of thisStorageMetadata

getName

public @NullableString getName()
Returns
@NullableString

a simple name of theStorageReference object

getPath

public @NonNullString getPath()
Returns
@NonNullString

the path of theStorageReference object

getReference

public @NullableStorageReference getReference()
Returns
@NullableStorageReference

the associatedStorageReference for which this metadata belongs to.

getSizeBytes

public long getSizeBytes()
Returns
long

the stored Size in bytes of theStorageReference object

getUpdatedTimeMillis

public long getUpdatedTimeMillis()
Returns
long

the time theStorageReference was last updated.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.