class Rsync {

    public static List<URI> generateCandidateParentUris(URI uri) {
        URI candidate = uri.normalize();
        if (!candidate.getPath().endsWith("/")) {
            candidate = URI.create(uri.toASCIIString() + "/");
        }

        final List<URI> result = new ArrayList<>();
        while (!"/".equals(candidate.getPath())) {
            candidate = candidate.resolve("..");
            result.add(candidate);
        }
        return result;
    }

    private  Rsync();

}