@Test public void testParseSegments() throws Exception { MatcherAssert.assertThat(parsePath("/this/that"), CoreMatchers.equalTo(Arrays.asList("this", "that"))); MatcherAssert.assertThat(parsePath("this/that"), CoreMatchers.equalTo(Arrays.asList("this", "that"))); MatcherAssert.assertThat(parsePath("this MatcherAssert.assertThat(parsePath("this MatcherAssert.assertThat(parsePath("this CoreMatchers.equalTo(Arrays.asList("this", "", "that", "/this and that"))); MatcherAssert.assertThat(parsePath("this CoreMatchers.equalTo(Arrays.asList("this", "", "", "that", "", ""))); MatcherAssert.assertThat(parsePath("/"), CoreMatchers.equalTo(Collections.singletonList(""))); MatcherAssert.assertThat(parsePath(""), CoreMatchers.equalTo(Collections.<String>emptyList())); }
static List<String> parsePath(final CharSequence s, final Charset charset) { if (s == null) { return null; } final List<String> segments = splitPath(s); final List<String> list = new ArrayList<>(segments.size()); for (final String segment: segments) { list.add(PercentCodec.decode(segment, charset)); } return list; }
URIBuilder { static List<String> parsePath(final CharSequence s, final Charset charset) { if (s == null) { return null; } final List<String> segments = splitPath(s); final List<String> list = new ArrayList<>(segments.size()); for (final String segment: segments) { list.add(PercentCodec.decode(segment, charset)); } return list; } }
URIBuilder { static List<String> parsePath(final CharSequence s, final Charset charset) { if (s == null) { return null; } final List<String> segments = splitPath(s); final List<String> list = new ArrayList<>(segments.size()); for (final String segment: segments) { list.add(PercentCodec.decode(segment, charset)); } return list; } URIBuilder();  URIBuilder(final String string);  URIBuilder(final URI uri);  URIBuilder(final String string, final Charset charset);  URIBuilder(final URI uri, final Charset charset); }
URIBuilder { static List<String> parsePath(final CharSequence s, final Charset charset) { if (s == null) { return null; } final List<String> segments = splitPath(s); final List<String> list = new ArrayList<>(segments.size()); for (final String segment: segments) { list.add(PercentCodec.decode(segment, charset)); } return list; } URIBuilder();  URIBuilder(final String string);  URIBuilder(final URI uri);  URIBuilder(final String string, final Charset charset);  URIBuilder(final URI uri, final Charset charset); static URIBuilder localhost(); static URIBuilder loopbackAddress(); URIBuilder setCharset(final Charset charset); Charset getCharset(); URI build(); URIBuilder setScheme(final String scheme); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart, final NameValuePair... nvps); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart, final List <NameValuePair> nvps); URIBuilder setUserInfo(final String userInfo); @Deprecated URIBuilder setUserInfo(final String username, final String password); URIBuilder setHost(final InetAddress host); URIBuilder setHost(final String host); URIBuilder setHttpHost(final HttpHost httpHost ); URIBuilder setPort(final int port); URIBuilder setPath(final String path); URIBuilder setPathSegments(final String... pathSegments); URIBuilder setPathSegmentsRootless(final String... pathSegments); URIBuilder setPathSegments(final List<String> pathSegments); URIBuilder setPathSegmentsRootless(final List<String> pathSegments); URIBuilder removeQuery(); URIBuilder setParameters(final List <NameValuePair> nvps); URIBuilder addParameters(final List <NameValuePair> nvps); URIBuilder setParameters(final NameValuePair... nvps); URIBuilder addParameter(final String param, final String value); URIBuilder setParameter(final String param, final String value); URIBuilder clearParameters(); URIBuilder setCustomQuery(final String query); URIBuilder setFragment(final String fragment); boolean isAbsolute(); boolean isOpaque(); String getScheme(); String getSchemeSpecificPart(); String getUserInfo(); String getHost(); int getPort(); boolean isPathEmpty(); List<String> getPathSegments(); String getPath(); boolean isQueryEmpty(); List<NameValuePair> getQueryParams(); String getFragment(); @Override String toString(); }
URIBuilder { static List<String> parsePath(final CharSequence s, final Charset charset) { if (s == null) { return null; } final List<String> segments = splitPath(s); final List<String> list = new ArrayList<>(segments.size()); for (final String segment: segments) { list.add(PercentCodec.decode(segment, charset)); } return list; } URIBuilder();  URIBuilder(final String string);  URIBuilder(final URI uri);  URIBuilder(final String string, final Charset charset);  URIBuilder(final URI uri, final Charset charset); static URIBuilder localhost(); static URIBuilder loopbackAddress(); URIBuilder setCharset(final Charset charset); Charset getCharset(); URI build(); URIBuilder setScheme(final String scheme); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart, final NameValuePair... nvps); URIBuilder setSchemeSpecificPart(final String schemeSpecificPart, final List <NameValuePair> nvps); URIBuilder setUserInfo(final String userInfo); @Deprecated URIBuilder setUserInfo(final String username, final String password); URIBuilder setHost(final InetAddress host); URIBuilder setHost(final String host); URIBuilder setHttpHost(final HttpHost httpHost ); URIBuilder setPort(final int port); URIBuilder setPath(final String path); URIBuilder setPathSegments(final String... pathSegments); URIBuilder setPathSegmentsRootless(final String... pathSegments); URIBuilder setPathSegments(final List<String> pathSegments); URIBuilder setPathSegmentsRootless(final List<String> pathSegments); URIBuilder removeQuery(); URIBuilder setParameters(final List <NameValuePair> nvps); URIBuilder addParameters(final List <NameValuePair> nvps); URIBuilder setParameters(final NameValuePair... nvps); URIBuilder addParameter(final String param, final String value); URIBuilder setParameter(final String param, final String value); URIBuilder clearParameters(); URIBuilder setCustomQuery(final String query); URIBuilder setFragment(final String fragment); boolean isAbsolute(); boolean isOpaque(); String getScheme(); String getSchemeSpecificPart(); String getUserInfo(); String getHost(); int getPort(); boolean isPathEmpty(); List<String> getPathSegments(); String getPath(); boolean isQueryEmpty(); List<NameValuePair> getQueryParams(); String getFragment(); @Override String toString();  }