public class GcsResourceId extends java.lang.Object implements ResourceId
ResourceId
implementation for Google Cloud Storage.Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
GcsResourceId |
getCurrentDirectory()
Returns the
ResourceId that represents the current directory of this ResourceId . |
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)
ResourceId
ResourceId
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("{@literal *}", StandardResolveOptions.RESOLVE_FILE)
returns a
ResourceId
which matches all files in this ResourceId
.
resourceId.resolve("{@literal *}", StandardResolveOptions.RESOLVE_DIRECTORY)
returns a ResourceId
which matches all directories in this ResourceId
.
resolve
in interface ResourceId
public GcsResourceId getCurrentDirectory()
ResourceId
ResourceId
that represents the current directory of this ResourceId
.
If it is already a directory, trivially returns this.
getCurrentDirectory
in interface ResourceId
public boolean isDirectory()
ResourceId
true
if this ResourceId
represents a directory, false otherwise.isDirectory
in interface ResourceId
public java.lang.String getScheme()
ResourceId
ResourceId
.
The scheme is required to follow URI scheme syntax. See RFC 2396
getScheme
in interface ResourceId
@Nullable public java.lang.String getFilename()
ResourceId
ResourceId
. The file name is
the farthest element from the root in the directory hierarchy.getFilename
in interface ResourceId
public java.lang.String toString()
ResourceId
ResourceId
.
The corresponding FileSystem.match(java.util.List<java.lang.String>)
is required to accept this string representation.
toString
in interface ResourceId
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object