However some systems and build environments might be flaky when it comes to Java SPI. This
is because services are generally runtime dependencies and depend on a META-INF file being
present in your jar (generated by Google Auto at compile-time). In such cases, this method
provides a simpler alternative.
See Also: #forBucket(String, CloudStorageConfiguration), java.nio.file.FileSystems#getFileSystem(java.net.URI)
Returns Google Cloud Storage FileSystem object for bucket.
Google Cloud Storage file system objects are basically free. You can create as many as you
want, even if you have multiple instances for the same bucket. There's no actual system
resources associated with this object. Therefore calling #close() on the returned value
is optional.
Note: It is also possible to instantiate this class via Java's
FileSystems.getFileSystem(URI.create("gs://bucket")). We discourage you from using that if
possible, for the reasons documented in CloudStorageFileSystemProvider#newFileSystem(URI, java.util.Map)
See Also: java.nio.file.FileSystems#getFileSystem(URI)
Lists the project's buckets. Pass "null" to use the default project.
Example of listing buckets, specifying the page size and a name prefix.
Stringprefix="bucket_";Page<Bucket>buckets=CloudStorageFileSystem.listBuckets("my-project",BucketListOption.prefix(prefix));Iterator<Bucket>bucketIterator=buckets.iterateAll();while(bucketIterator.hasNext()){Bucketbucket=bucketIterator.next();// do something with the bucket}
Does nothing currently. This method might be updated in the future to close all channels
associated with this file system object. However it's unlikely that even then, calling this
method will become mandatory.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-28 UTC."],[],[]]