public class GoogleStorageLocation extends Object
Constructor and Description |
---|
GoogleStorageLocation(String gcsLocationUriString)
Constructs a
GoogleStorageLocation based on the provided Google Storage URI string. |
Modifier and Type | Method and Description |
---|---|
static GoogleStorageLocation |
forBucket(String bucketName)
Returns a
GoogleStorageLocation to a bucket. |
static GoogleStorageLocation |
forFile(String bucketName,
String pathToFile)
Returns a
GoogleStorageLocation for a file within a bucket. |
static GoogleStorageLocation |
forFolder(String bucketName,
String pathToFolder)
Returns a
GoogleStorageLocation to a folder whose path is relative to the
bucket. |
String |
getBlobName()
Returns the path to the blob/folder relative from the bucket root.
|
String |
getBucketName()
Returns the Google Storage bucket name.
|
boolean |
isBucket()
Check if the location references a bucket and not a blob.
|
boolean |
isFile()
Returns whether this
GoogleStorageLocation represents a file or not. |
boolean |
isFolder()
Returns whether this
GoogleStorageLocation represents a folder. |
String |
toString() |
URI |
uri()
Returns the GCS URI of the location.
|
String |
uriString()
Returns the Google Storage URI string for the location.
|
public GoogleStorageLocation(String gcsLocationUriString)
GoogleStorageLocation
based on the provided Google Storage URI string.
The URI string is of the form: gs://<BUCKET_NAME>/<PATH_TO_FILE>
gcsLocationUriString
- a Google Storage URI string to a bucket/folder/file.public boolean isBucket()
public boolean isFile()
GoogleStorageLocation
represents a file or not.public boolean isFolder()
GoogleStorageLocation
represents a folder.public String getBucketName()
public String getBlobName()
GoogleStorageLocation
specifies a bucket itself.public URI uri()
public String uriString()
public static GoogleStorageLocation forBucket(String bucketName)
GoogleStorageLocation
to a bucket.bucketName
- name of the GCS bucketGoogleStorageLocation
to the location.public static GoogleStorageLocation forFile(String bucketName, String pathToFile)
GoogleStorageLocation
for a file within a bucket.bucketName
- name of the GCS bucketpathToFile
- path to the file within the bucketGoogleStorageLocation
to the location.public static GoogleStorageLocation forFolder(String bucketName, String pathToFolder)
GoogleStorageLocation
to a folder whose path is relative to the
bucket.bucketName
- name of the GCS bucket.pathToFolder
- path to the folder within the bucket.GoogleStorageLocation
to the location.Copyright © 2021. All rights reserved.