public class GcsResourceId extends java.lang.Object implements ResourceId
ResourceId implementation for Google Cloud Storage.| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(@Nullable java.lang.Object obj) |
GcsResourceId |
getCurrentDirectory()
Returns the
ResourceId that represents the current directory of this ResourceId. |
@Nullable java.lang.String |
getFilename()
Returns the name of the file or directory denoted by this
ResourceId. |
java.lang.String |
getScheme()
Get the scheme which defines the namespace of the
ResourceId. |
int |
hashCode() |
boolean |
isDirectory()
Returns
true if this ResourceId represents a directory, false otherwise. |
GcsResourceId |
resolve(java.lang.String other,
ResolveOptions resolveOptions)
Returns a child
ResourceId under this. |
java.lang.String |
toString()
Returns the string representation of this
ResourceId. |
public GcsResourceId resolve(java.lang.String other, ResolveOptions resolveOptions)
ResourceIdResourceId under this.
In order to write file system agnostic code, callers should not include delimiters in other, and should use ResolveOptions.StandardResolveOptions to specify whether to resolve a file or a
directory.
For example:
ResourceId homeDir = ...;
ResourceId tempOutput = homeDir
.resolve("tempDir", StandardResolveOptions.RESOLVE_DIRECTORY)
.resolve("output", StandardResolveOptions.RESOLVE_FILE);
This ResourceId should represents a directory.
It is up to each file system to resolve in their own way.
Resolving special characters:
resourceId.resolve("..", StandardResolveOptions.RESOLVE_DIRECTORY) returns the
parent directory of this ResourceId.
resourceId.resolve("*", StandardResolveOptions.RESOLVE_FILE) returns a ResourceId which matches all files in this ResourceId.
resourceId.resolve("*", StandardResolveOptions.RESOLVE_DIRECTORY) returns a
ResourceId which matches all directories in this ResourceId.
resolve in interface ResourceIdpublic GcsResourceId getCurrentDirectory()
ResourceIdResourceId that represents the current directory of this ResourceId.
If it is already a directory, trivially returns this.
getCurrentDirectory in interface ResourceIdpublic boolean isDirectory()
ResourceIdtrue if this ResourceId represents a directory, false otherwise.isDirectory in interface ResourceIdpublic java.lang.String getScheme()
ResourceIdResourceId.
The scheme is required to follow URI scheme syntax. See RFC 2396
getScheme in interface ResourceIdpublic @Nullable java.lang.String getFilename()
ResourceIdResourceId. The file name is
the farthest element from the root in the directory hierarchy.getFilename in interface ResourceIdpublic java.lang.String toString()
ResourceIdResourceId.
The corresponding FileSystem.match(java.util.List<java.lang.String>) is required to accept this string representation.
toString in interface ResourceIdtoString in class java.lang.Objectpublic boolean equals(@Nullable java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object