java.lang.Object
org.elasticsearch.xpack.esql.datasources.spi.StoragePath

public final class StoragePath extends Object
Represents a location in a storage system. Uses URI-like format: scheme://[userInfo@]host[:port][/path] Unlike java.net.URI, this class: - Does not perform URL encoding/decoding - Has simpler parsing rules suitable for blob storage keys - Provides convenient methods for path manipulation Note: glob pattern detection (isPattern()) only inspects the path component. Glob characters in the scheme or authority (e.g. s3://bucket-*/data/) are not detected as patterns and will be treated as literal text.
  • Field Details

  • Method Details

    • fileUri

      public static String fileUri(Path path)
      Converts a local filesystem Path to a properly formatted file:// URI string. Normalizes Windows backslashes and ensures the URI has three slashes (file:///).
    • of

      public static StoragePath of(String location)
    • scheme

      public String scheme()
    • host

      public String host()
    • port

      public int port()
    • path

      public String path()
    • localPath

      public String localPath()
      Returns the path component adjusted for use as a local filesystem path. On Windows, file:// URIs produce paths like /C:/dir/file where the leading slash is invalid for the OS. This method strips it when a drive letter is detected so the result can be passed to PathUtils.get() safely.
    • objectName

      public String objectName()
    • parentDirectory

      public StoragePath parentDirectory()
    • appendPath

      public StoragePath appendPath(String element)
    • isPattern

      public boolean isPattern()
      Returns true if the path contains glob metacharacters: *, ?, {, [
    • patternPrefix

      public StoragePath patternPrefix()
      Returns a new StoragePath truncated to the longest non-pattern prefix directory. e.g. "s3://b/data/2024/*.parquet" -> "s3://b/data/2024/"
    • globPart

      public String globPart()
      Returns the glob portion of the path (everything after the prefix directory). e.g. "s3://b/data/2024/*.parquet" -> "*.parquet"
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object