@Test public void appendPath_decoded() throws Exception { logger.debug("[{}]appendPath_decoded: entered.", Integer.toHexString(identityHashCode(this))); final String unencodedPath = "/#Tag"; final URL url = new URI("file", "/tmp/UrlUtilTest/parentFolder", null).toURL(); final String expected = "file:/tmp/UrlUtilTest/parentFolder/%23Tag"; final URL actual = UrlUtil.appendNonEncodedPath(url, unencodedPath); assertEquals(expected, actual.toString()); }
public static URL appendNonEncodedPath(final URL url, final String path) { requireNonNull(url, "url"); if (path == null || path.isEmpty()) return url; final String[] pathSegments = path.split("/"); final List<String> encodedPathSegments = new ArrayList<String>(pathSegments.length); for (final String pathSegment : pathSegments) { encodedPathSegments.add(UrlEncoder.encode(pathSegment)); } return appendEncodedPath(url, encodedPathSegments); }
UrlUtil { public static URL appendNonEncodedPath(final URL url, final String path) { requireNonNull(url, "url"); if (path == null || path.isEmpty()) return url; final String[] pathSegments = path.split("/"); final List<String> encodedPathSegments = new ArrayList<String>(pathSegments.length); for (final String pathSegment : pathSegments) { encodedPathSegments.add(UrlEncoder.encode(pathSegment)); } return appendEncodedPath(url, encodedPathSegments); } }
UrlUtil { public static URL appendNonEncodedPath(final URL url, final String path) { requireNonNull(url, "url"); if (path == null || path.isEmpty()) return url; final String[] pathSegments = path.split("/"); final List<String> encodedPathSegments = new ArrayList<String>(pathSegments.length); for (final String pathSegment : pathSegments) { encodedPathSegments.add(UrlEncoder.encode(pathSegment)); } return appendEncodedPath(url, encodedPathSegments); } private  UrlUtil(); }
UrlUtil { public static URL appendNonEncodedPath(final URL url, final String path) { requireNonNull(url, "url"); if (path == null || path.isEmpty()) return url; final String[] pathSegments = path.split("/"); final List<String> encodedPathSegments = new ArrayList<String>(pathSegments.length); for (final String pathSegment : pathSegments) { encodedPathSegments.add(UrlEncoder.encode(pathSegment)); } return appendEncodedPath(url, encodedPathSegments); } private  UrlUtil(); static URL canonicalizeURL(final URL url); static File getFile(final URL url); static URL appendEncodedPath(final URL url, final String path); static URL appendNonEncodedPath(final URL url, final String path); static final URI urlToUri(final URL url); static File getFileFromJarUrl(final URL url); static URL getFileUrlFromJarUrl(final URL url); }
UrlUtil { public static URL appendNonEncodedPath(final URL url, final String path) { requireNonNull(url, "url"); if (path == null || path.isEmpty()) return url; final String[] pathSegments = path.split("/"); final List<String> encodedPathSegments = new ArrayList<String>(pathSegments.length); for (final String pathSegment : pathSegments) { encodedPathSegments.add(UrlEncoder.encode(pathSegment)); } return appendEncodedPath(url, encodedPathSegments); } private  UrlUtil(); static URL canonicalizeURL(final URL url); static File getFile(final URL url); static URL appendEncodedPath(final URL url, final String path); static URL appendNonEncodedPath(final URL url, final String path); static final URI urlToUri(final URL url); static File getFileFromJarUrl(final URL url); static URL getFileUrlFromJarUrl(final URL url); static final String PROTOCOL_FILE; static final String PROTOCOL_JAR; }