Path implements Comparable<Path>, Serializable, ObjectInputValidation { public URI toUri() { return uri; } Path(String parent, String child);  Path(Path parent, String child);  Path(String parent, Path child);  Path(Path parent, Path child);  Path(String pathString);  Path(URI aUri);  Path(String scheme, String authority, String path); static Path getPathWithoutSchemeAndAuthority(Path path); static Path mergePaths(Path path1, Path path2); static boolean isWindowsAbsolutePath(final String pathString,
                                              final boolean slashed); URI toUri(); FileSystem getFileSystem(Configuration conf); boolean isAbsoluteAndSchemeAuthorityNull(); boolean isUriPathAbsolute(); boolean isAbsolute(); boolean isRoot(); String getName(); Path getParent(); Path suffix(String suffix); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(Path o); int depth(); @Deprecated Path makeQualified(FileSystem fs); @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"}) Path makeQualified(URI defaultUri, Path workingDir ); @Override void validateObject(); static final String SEPARATOR; static final char SEPARATOR_CHAR; static final String CUR_DIR; static final boolean WINDOWS; }
@Test (timeout = 30000) public void testPathToUriConversion() throws URISyntaxException, IOException { assertEquals("? mark char in to URI", new URI(null, null, "/foo?bar", null, null), new Path("/foo?bar").toUri()); assertEquals("escape slashes chars in to URI", new URI(null, null, "/foo\"bar", null, null), new Path("/foo\"bar").toUri()); assertEquals("spaces in chars to URI", new URI(null, null, "/foo bar", null, null), new Path("/foo bar").toUri()); assertEquals("/foo?bar", new Path("http: assertEquals("/foo", new URI("http: assertEquals(new URI("/foo;bar").getPath(), new Path("/foo;bar").toUri().getPath()); assertEquals(new URI("/foo;bar"), new Path("/foo;bar").toUri()); assertEquals(new URI("/foo+bar"), new Path("/foo+bar").toUri()); assertEquals(new URI("/foo-bar"), new Path("/foo-bar").toUri()); assertEquals(new URI("/foo=bar"), new Path("/foo=bar").toUri()); assertEquals(new URI("/foo,bar"), new Path("/foo,bar").toUri()); }