StorageClient

public class StorageClient extends Object

StorageClient provides access to Google Cloud Storage APIs. You can specify a default cloud storage bucket via FirebaseOptions, and then get a reference to this default bucket by calling bucket(). Or you can get a reference to a specific bucket at any time by calling bucket(String).

This class requires Google Cloud Storage libraries for Java. Make sure the artifact google-cloud-storage is in the classpath along with its transitive dependencies.

Public Method Summary

Bucket
bucket()
Returns the default cloud storage bucket associated with the current app.
Bucket
bucket(String name)
Returns a cloud storage Bucket instance for the specified bucket name.
static StorageClient
synchronized static StorageClient

Inherited Method Summary

Public Methods

public Bucket bucket ()

Returns the default cloud storage bucket associated with the current app. This is the bucket configured via FirebaseOptions when initializing the app. If no bucket was configured via options, this method throws an exception.

Returns
  • a cloud storage Bucket instance.
Throws
IllegalArgumentException If no bucket is configured via FirebaseOptions, or if the bucket does not exist.

public Bucket bucket (String name)

Returns a cloud storage Bucket instance for the specified bucket name.

Parameters
name a non-null, non-empty bucket name.
Returns
  • a cloud storage Bucket instance.
Throws
IllegalArgumentException If the bucket name is null, empty, or if the specified bucket does not exist.

public static StorageClient getInstance ()

public static synchronized StorageClient getInstance (FirebaseApp app)