{@inheritDoc} If this URI was created by #parse(String) or #create(String), then the returned string will match that original input exactly.
()
| 611 | * returned string will match that original input exactly. |
| 612 | */ |
| 613 | @Override |
| 614 | public String toString() { |
| 615 | // https://datatracker.ietf.org/doc/html/rfc3986#section-5.3 |
| 616 | StringBuilder sb = new StringBuilder(); |
| 617 | sb.append(scheme).append(':'); |
| 618 | if (hasAuthority()) { |
| 619 | sb.append("//"); |
| 620 | appendAuthority(sb); |
| 621 | } |
| 622 | sb.append(path); |
| 623 | if (query != null) { |
| 624 | sb.append('?').append(query); |
| 625 | } |
| 626 | if (fragment != null) { |
| 627 | sb.append('#').append(fragment); |
| 628 | } |
| 629 | return sb.toString(); |
| 630 | } |
| 631 | |
| 632 | /** |
| 633 | * Returns true iff this URI has a scheme and an authority/path hierarchy, but no fragment. |