Create a new Path from its string representation.

@param resourceName The Firestore resource name of this path.
502362
static ResourcePath create(String resourceName) {
    String[] parts = resourceName.split("/");

    if (parts.length >= 6 && parts[0].equals("projects") && parts[2].equals("databases")) {
      String[] path = Arrays.copyOfRange(parts, 5, parts.length);
      return create(
          DatabaseRootName.of(parts[1], parts[3]),
          ImmutableList.<String>builder().add(path).build());
    }

    return create(DatabaseRootName.parse(resourceName));
  }
1352366
public static String getNameForClassloaderResource(String resourceName) {
        String fileName = resourceName;
        if (resourceName.indexOf('/') != -1) {
            fileName = resourceName.substring(resourceName.lastIndexOf('/') + 1, resourceName.length());
        }
        return fileName;
    }
493727
@Override
    public final T addAsManifestResource(String resourceName) {
        Validate.notNull(resourceName, "ResourceName should be specified");
        return addAsManifestResource(fileFromResource(resourceName), resourceName);
    }
1213720
public static PackageIndex<Integer> createPackageIndex(String resourceName) {
        PackageIndex<Integer> packageIndex = new PackageIndex<Integer>();

        BufferedReader br = null;
        try {
            br = getLibertyTraceListReader(resourceName);
            addFiltersAndValuesToIndex(br, packageIndex);
        } catch (IOException e) {
            System.err.println("Unable to load " + resourceName);
        } finally {
            tryToCloseReader(br);
        }

        packageIndex.compact();
        return packageIndex;
    }
927176
@Override
	public Set<String> getResourceNames(String path) {

		String resourcePath = getResolver().getResourcePath(path);
		return rsBrowser.getResourceNames(resourcePath);
	}
855557
@Nullable
  public static ResourceName createFromFullName(PathTemplate template, String path) {
    ImmutableMap<String, String> values = template.matchFromFullName(path);
    if (values == null) {
      return null;
    }
    return new ResourceName(template, values, null);
  }
526405
public static String loadAsString(String resourceFileName) throws IOException, URISyntaxException {
        try (InputStream is = ResourceLoader.class.getClassLoader().getResourceAsStream(resourceFileName)) {
            StringWriter stringWriter = new StringWriter();
            IOUtils.copy(is, stringWriter, StandardCharsets.UTF_8);
            return stringWriter.toString();
        }
    }
43114
public Configuration createFromResource(String resourceName) {
        Exceptions.nullArgument("resourceName", resourceName);

        Configuration configuration;
        try {
            InputStream stream = null;
            try {
                stream = Utils.openResourceStream(resourceName);

                if (stream != null) {
                    configuration = create(stream);
                } else {
                    throw new TextProcessorFactoryException("Can't find or open resource \"" + resourceName + "\".");
                }
            } finally {
                if (stream != null) {
                    stream.close();
                }
            }
        } catch (IOException e) {
            throw new TextProcessorFactoryException(e);
        }

        return configuration;
    }
1001904
public static File getResourceFile(String resourceName) throws URISyntaxException, ClassNotFoundException {
        URL url = ResourceUtil.class.getClassLoader().getResource(resourceName);
        assert url != null : resourceName;
        return new File(url.toURI());
    }
1048539
public static Xml readAllFromResource(String resourceName)  {
        InputStream is = XmlReader.class.getResourceAsStream(resourceName);
        XmlReader reader = new XmlReader(is);
        Xml xml = reader.read("node()");
        reader.close();
        return xml;
    }
1013098
public ResourceInjection byName(final String name) {

        final ResourceLiteral resource = new ResourceLiteral();
        resource.setName(name);
        matchingResources.add(resource);
        return this;
    }
877699
public static Document resourceFileToXMLDocument(final String location, final String fileName) {
        if (location == null || fileName == null) return null;

        final InputStream in = ResourceUtilities.class.getResourceAsStream(location + fileName);
        if (in == null) return null;

        final DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        final DocumentBuilder dBuilder;
        Document doc = null;
        try {
            dBuilder = dbFactory.newDocumentBuilder();
            doc = dBuilder.parse(in);
        } catch (Exception e) {
            LOG.error("Failed to parse the resource as XML.", e);
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                LOG.error("Failed to close the InputStream", e);
            }
        }
        return doc;
    }
571337
public static String resourceFileToString(final String location, final String fileName) {
        if (location == null || fileName == null) return null;

        final InputStream in = ResourceUtilities.class.getResourceAsStream(location + fileName);
        if (in == null) return null;

        final BufferedReader br = new BufferedReader(new InputStreamReader(in));
        String line;
        final StringBuilder output = new StringBuilder("");
        try {
            while ((line = br.readLine()) != null) {
                output.append(line + "\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                LOG.error("Failed to close the InputStream", e);
            }
            try {
                br.close();
            } catch (IOException e) {
                LOG.error("Failed to close the BufferedReader", e);
            }
        }
        return output.toString();
    }
1364286
private String attachRequestString(String resourceName) {

        StringBuffer result = new StringBuffer(resourceName);
        boolean firstParam = true;
        if (resourceName.indexOf('?') == -1) {
            // no params in uri yet?
            result.append('?');
        } else {
            firstParam = false;
        }

        @SuppressWarnings("unchecked")
        Map<String, String[]> params = getJsp().getRequest().getParameterMap();
        Iterator<Map.Entry<String, String[]>> it = params.entrySet().iterator();
        String[] values = null;
        while (it.hasNext()) {
            if (values == null) {
                // first iteration: check if params before so an & has to be used.
                if (!firstParam) {
                    result.append('&');
                }
            } else {
                result.append("&");
            }
            Map.Entry<String, String[]> entry = it.next();
            result.append(entry.getKey().toString()).append('=');
            values = entry.getValue();
            for (int i = 0; i < values.length; i++) {
                result.append(values[i]);
                if ((i + 1) < values.length) {
                    result.append(',');
                }
            }
        }
        return result.toString();
    }
1095758
@Override
    public T addAsLibrary(String resourceName, String target) throws IllegalArgumentException {
        Validate.notNull(resourceName, "ResourceName must be specified");
        Validate.notNull(target, "Target must be specified");

        return addAsLibrary(resourceName, new BasicPath(target));
    }
263444
@Override
    public final T addAsResource(String resourceName) throws IllegalArgumentException {
        Validate.notNull(resourceName, "ResourceName should be specified");
        return addAsResource(resourceName, resourceName);
    }
163074
@SuppressWarnings("unchecked")
    public <T extends WebLocatorAbstractBuilder> T setName(final String name) {
        pathBuilder.setName(name);
        return (T) this;
    }