Beispiel #1
0
  public static List<String> list(final String path) {

    URI uri = URI.create(path);
    if (uri.getScheme() == null) {
      final Path pathFromFileSystem = path(path);
      return list(pathFromFileSystem);
    } else if (uri.getScheme().equals(CLASSPATH_SCHEMA)) {

      return listFromDefaultClassLoader(StringScanner.split(path, ':')[1]);

    } else {
      final Path pathFromFileSystem = path(path);
      return list(pathFromFileSystem);
    }
  }
Beispiel #2
0
  public static Path path(String location) {
    if (!location.startsWith(CLASSPATH_SCHEMA + ":")) {
      return Paths.get(location);
    } else {
      String path = StringScanner.split(location, ':')[1];

      final List<Path> resources = Classpaths.resources(IO.class, path);

      Path result = Lists.idx(resources, 0);
      if (result == null) {
        return path(path);
      }
      return result;
    }
  }