MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / parseSchemeSpecificPart

Method parseSchemeSpecificPart

vm/JavaAPI/src/java/net/URI.java:524–551  ·  view source on GitHub ↗

Utility method used to parse a given scheme specific part. If parameter encode=true, then the result will be encoded, otherwise the result will be validated to ensure encoding is valid. Typically the multi-parameter constructors will call this method with encode=true, and the single parameter constr

(String ssp, boolean encode)

Source from the content-addressed store, hash-verified

522 * @throws URISyntaxException if the ssp is invalid.
523 */
524 protected void parseSchemeSpecificPart(String ssp, boolean encode) throws URISyntaxException {
525 if (ssp == null) {
526 throw new URISyntaxException(ssp, "Invalid scheme specific part");
527 }
528 if (scheme != null && ssp.charAt(0) != PATH_SEPARATOR) {
529 this.opaque = true;
530 this.schemeSpecificPart = ssp;
531 return;
532 }
533 int index;
534 String s = ssp;
535
536 if ((index = s.lastIndexOf(QUERY_MARKER)) != -1) {
537 setQuery(s.substring(index + 1), encode);
538 s = s.substring(0, index);
539 } else if (getQuerySeparator() == SOCKET_QUERY_SEPARATOR && (index = s.indexOf(SOCKET_QUERY_SEPARATOR)) != -1) {
540 setQuery(s.substring(index + 1).replace(SOCKET_QUERY_SEPARATOR, QUERY_SEPARATOR), encode);
541 s = s.substring(0, index);
542 }
543
544 index = (s.startsWith(AUTHORITY_MARKER)) ? 2 : 0;
545 index = s.indexOf(PATH_SEPARATOR, index);
546 if (index != -1) {
547 setPath(s.substring(index), encode);
548 s = s.substring(0, index);
549 }
550 setAuthority(s, encode);
551 }
552
553 /**
554 * Internal utility method to throw a syntax error if a value can not be

Callers 2

setSchemeSpecificPartMethod · 0.95
parseURIMethod · 0.95

Calls 10

lastIndexOfMethod · 0.95
setQueryMethod · 0.95
substringMethod · 0.95
getQuerySeparatorMethod · 0.95
indexOfMethod · 0.95
startsWithMethod · 0.95
setPathMethod · 0.95
setAuthorityMethod · 0.95
charAtMethod · 0.65
replaceMethod · 0.65

Tested by

no test coverage detected