Class GcsResourceId

java.lang.Object
org.apache.beam.sdk.extensions.gcp.storage.GcsResourceId
All Implemented Interfaces:
Serializable, ResourceId

public class GcsResourceId extends Object implements ResourceId
ResourceId implementation for Google Cloud Storage.
See Also:
  • Method Details

    • resolve

      public GcsResourceId resolve(String other, ResolveOptions resolveOptions)
      Description copied from interface: ResourceId
      Returns a child 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("*", 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.
      Specified by:
      resolve in interface ResourceId
    • getCurrentDirectory

      public GcsResourceId getCurrentDirectory()
      Description copied from interface: ResourceId
      Returns the ResourceId that represents the current directory of this ResourceId.

      If it is already a directory, trivially returns this.

      Specified by:
      getCurrentDirectory in interface ResourceId
    • isDirectory

      public boolean isDirectory()
      Description copied from interface: ResourceId
      Returns true if this ResourceId represents a directory, false otherwise.
      Specified by:
      isDirectory in interface ResourceId
    • getScheme

      public String getScheme()
      Description copied from interface: ResourceId
      Get the scheme which defines the namespace of the ResourceId.

      The scheme is required to follow URI scheme syntax. See RFC 2396

      Specified by:
      getScheme in interface ResourceId
    • getFilename

      public @Nullable String getFilename()
      Description copied from interface: ResourceId
      Returns the name of the file or directory denoted by this ResourceId. The file name is the farthest element from the root in the directory hierarchy.
      Specified by:
      getFilename in interface ResourceId
      Returns:
      a string representing the name of file or directory, or null if there are zero components.
    • toString

      public String toString()
      Description copied from interface: ResourceId
      Returns the string representation of this ResourceId.

      The corresponding FileSystem.match(java.util.List<java.lang.String>) is required to accept this string representation.

      Specified by:
      toString in interface ResourceId
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object