public static WasbUri parse()

in src/main/java/com/microsoft/azure/spark/tools/utils/WasbUri.java [78:103]


    public static WasbUri parse(final String blobUri) {
        Matcher matcher;
        if (StringUtils.startsWithIgnoreCase(blobUri, "wasb")) {
            matcher = WASB_URI_PATTERN.matcher(blobUri);
        } else if (StringUtils.startsWithIgnoreCase(blobUri, "http")) {
            matcher = HTTP_URI_PATTERN.matcher(blobUri);
        } else {
            throw new UnknownFormatConversionException("Unsupported Azure blob URI Scheme: " + blobUri);
        }

        if (matcher.matches()) {
            final WasbUri wasbUri = new WasbUri(URI.create(blobUri));

            wasbUri.container.set(matcher.group("container"));
            wasbUri.storageAccount.set(matcher.group("storageAccount"));
            wasbUri.endpointSuffix.set(matcher.group("endpointSuffix"));

            final String pathMatched = matcher.group("path");
            final String absolutePathMatched = URI.create("/" + (pathMatched == null ? "" : pathMatched)).getPath();
            wasbUri.absolutePath.set(absolutePathMatched);

            return wasbUri;
        }

        throw new UnknownFormatConversionException("Unmatched Azure blob URI: " + blobUri);
    }