Package java.net

Examples of java.net.URI.relativize()


            base = new URI(CxfConstants.PROTOCOL_NAME_RES, "", "/", "");
        } catch (URISyntaxException e) {
            // this shouldn't fail
            e.printStackTrace();
        }
        return base.relativize(uri).getPath();
    }
}
View Full Code Here


            URI baseURI = configurationDir.getAbsoluteFile().toURI();
            Collection files = listRecursiveFiles(configurationDir);
            for (Iterator iterator = files.iterator(); iterator.hasNext();) {
                File file = (File) iterator.next();
                String relativePath = baseURI.relativize(file.toURI()).getPath();
                if (!EXCLUDED.contains(relativePath)) {
                    InputStream in = new FileInputStream(file);
                    try {
                        out.putNextEntry(new ZipEntry(relativePath));
                        try {
View Full Code Here

        a = new URI("file:///~/dictionary");
        b = new URI("file://tools/~/dictionary");
        assertEquals("relativized incorrectly,", new URI(
                "file://tools/~/dictionary"), a.relativize(b));
        assertEquals("relativized incorrectly,",
                new URI("file:///~/dictionary"), b.relativize(a));

        // two URIs with empty hosts
        b = new URI("file:///~/therasus");
        assertEquals("relativized incorrectly,", new URI("file:///~/therasus"),
                a.relativize(b));
View Full Code Here

        // two URIs with empty hosts
        b = new URI("file:///~/therasus");
        assertEquals("relativized incorrectly,", new URI("file:///~/therasus"),
                a.relativize(b));
        assertEquals("relativized incorrectly,",
                new URI("file:///~/dictionary"), b.relativize(a));
    }

    /**
     * @tests java.net.URI#resolve(java.net.URI)
     */
 
View Full Code Here

        a = new URI("file:///~/first");
        b = new URI("file://tools/~/first");
        assertEquals("Assert 1: URI relativized incorrectly,", new URI(
                "file://tools/~/first"), a.relativize(b));
        assertEquals("Assert 2: URI relativized incorrectly,", new URI(
                "file:///~/first"), b.relativize(a));

        // Both URIs with empty hosts
        b = new URI("file:///~/second");
        assertEquals("Assert 3: URI relativized incorrectly,", new URI(
                "file:///~/second"), a.relativize(b));
View Full Code Here

        // Both URIs with empty hosts
        b = new URI("file:///~/second");
        assertEquals("Assert 3: URI relativized incorrectly,", new URI(
                "file:///~/second"), a.relativize(b));
        assertEquals("Assert 4: URI relativized incorrectly,", new URI(
                "file:///~/first"), b.relativize(a));
    }

    /**
     * @tests java.net.URI#relativize(java.net.URI)
     */
 
View Full Code Here

        a = new URI("file:///~/dictionary");
        b = new URI("file://tools/~/dictionary");
        assertEquals("relativized incorrectly,", new URI(
                "file://tools/~/dictionary"), a.relativize(b));
        assertEquals("relativized incorrectly,",
                new URI("file:///~/dictionary"), b.relativize(a));

        // two URIs with empty hosts
        b = new URI("file:///~/therasus");
        assertEquals("relativized incorrectly,", new URI("file:///~/therasus"),
                a.relativize(b));
View Full Code Here

        // two URIs with empty hosts
        b = new URI("file:///~/therasus");
        assertEquals("relativized incorrectly,", new URI("file:///~/therasus"),
                a.relativize(b));
        assertEquals("relativized incorrectly,",
                new URI("file:///~/dictionary"), b.relativize(a));

        URI one = new URI("file:/C:/test/ws");
        URI two = new URI("file:/C:/test/ws");

        URI empty = new URI("");
View Full Code Here

            URI baseURI = configurationDir.getAbsoluteFile().toURI();
            Collection files = listRecursiveFiles(configurationDir);
            for (Iterator iterator = files.iterator(); iterator.hasNext();) {
                File file = (File) iterator.next();
                String relativePath = baseURI.relativize(file.toURI()).getPath();
                if (!EXCLUDED.contains(relativePath)) {
                    InputStream in = new FileInputStream(file);
                    try {
                        out.putNextEntry(new ZipEntry(relativePath));
                        try {
View Full Code Here

    do {
      PartialListing listing = store.list(key, S3_MAX_LISTING_LENGTH,
          priorLastKey);
      for (FileMetadata fileMetadata : listing.getFiles()) {
        Path subpath = keyToPath(fileMetadata.getKey());
        String relativePath = pathUri.relativize(subpath.toUri()).getPath();
        if (relativePath.endsWith(FOLDER_SUFFIX)) {
          status.add(newDirectory(new Path(absolutePath,
              relativePath.substring(0,
                  relativePath.indexOf(FOLDER_SUFFIX)))));
        } else {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.