src/main/java/org/owasp/url/Scheme.java
public void recompose(CharSequence source, PartRanges ranges, StringBuilder out) {
    Preconditions.checkArgument(
        ranges.contentLeft < 0 && ranges.contentMetadataLeft < 0);
    boolean wroteAuth = false;
    int al = ranges.authorityLeft;
    int ar = ranges.authorityRight;
//    System.err.println("al=" + al + ", ar=" + ar + ", this.naturallyHasAuthority=" + this.naturallyHasAuthority);
    if (al >= 0 || this.naturallyHasAuthority) {
      out.append("//");
      if (al >= 0) {
        out.append(source, al, ar);
      }
      wroteAuth = true;
    }

    int pl = ranges.pathLeft;
    int pr = ranges.pathRight;
    //    System.err.println("wroteAuth=" + wroteAuth);
    //    System.err.println("source=" + source);
    //    System.err.println("pl=" + pr);
    //    System.err.println("pr=" + pl);
    if (pl >= 0 && pl != pr) {
      if (wroteAuth && source.charAt(pl) != '/') {
        // Make sure a relative path part doesn't merge into the
        // authority.
        out.append('/');
      } else if (!wroteAuth && pl + 1 < pr && '/' == source.charAt(pl)) {
        // If the path starts with "//" make sure it is not ambiguous with
        // an authority.
        out.append("//");
        wroteAuth = true;
      }
      out.append(source, pl, pr);
    }
    //    System.err.println("out=" + out);

    int ql = ranges.queryLeft;
    int qr = ranges.queryRight;
    recomposeQuery(source, ql, qr, out);

    int fl = ranges.fragmentLeft;
    int fr = ranges.fragmentRight;
    recomposeFragment(source, fl, fr, out);
  }
/**
   * Appends a scheme specific part onto out using the ranges into source.
   *
   * <p>This method and all overrides must append equivalent output given
   * the same inputs, and must not destructively modify any input.
   *
   * @param source A string that contains the parts of the URL to recompose.
   *     It need not itself be a valid URL.
   * @param ranges The position of the parts of the URL to recompose in source.
   * @param out an output buffer to which the scheme specific part is appended.
   */
Appends a scheme specific part onto out using the ranges into source.
This method and all overrides must append equivalent output given
the same inputs, and must not destructively modify any input.

@param source A string that contains the parts of the URL to recompose.
It need not itself be a valid URL.
@param ranges The position of the parts of the URL to recompose in source.
@param out an output buffer to which the scheme specific part is appended.
Appends a scheme specific part onto out using the ranges into source . This method and all overrides must append equivalent output given the same inputs and must not destructively modify any input . @param source A string that contains the parts of the URL to recompose . It need not itself be a valid URL . @param ranges The position of the parts of the URL to recompose in source . @param out an output buffer to which the scheme specific part is appended .
public void recompose(CharSequence source, PartRanges ranges, StringBuilder out) {
    Preconditions.checkArgument(
        ranges.contentLeft < 0 && ranges.contentMetadataLeft < 0);
    boolean wroteAuth = false;
    int al = ranges.authorityLeft;
    int ar = ranges.authorityRight;
    if (al >= 0 || this.naturallyHasAuthority) {
      out.append("//");
      if (al >= 0) {
        out.append(source, al, ar);
      }
      wroteAuth = true;
    }
    int pl = ranges.pathLeft;
    int pr = ranges.pathRight;
    if (pl >= 0 && pl != pr) {
      if (wroteAuth && source.charAt(pl) != '/') {
        out.append('/');
      } else if (!wroteAuth && pl + 1 < pr && '/' == source.charAt(pl)) {
        out.append("//");
        wroteAuth = true;
      }
      out.append(source, pl, pr);
    }
    int ql = ranges.queryLeft;
    int qr = ranges.queryRight;
    recomposeQuery(source, ql, qr, out);
    int fl = ranges.fragmentLeft;
    int fr = ranges.fragmentRight;
    recomposeFragment(source, fl, fr, out);
  }
public void recompose ( CharSequence source , PartRanges ranges , StringBuilder out ) { Preconditions . checkArgument ( ranges . contentLeft < 0 && ranges . contentMetadataLeft < 0 ) ; boolean wroteAuth = false ; int al = ranges . authorityLeft ; int ar = ranges . authorityRight ; if ( al >= 0 || this . naturallyHasAuthority ) { out . append ( "//" ) ; if ( al >= 0 ) { out . append ( source , al , ar ) ; } wroteAuth = true ; } int pl = ranges . pathLeft ; int pr = ranges . pathRight ; if ( pl >= 0 && pl != pr ) { if ( wroteAuth && source . charAt ( pl ) != '/' ) { out . append ( '/' ) ; } else if ( ! wroteAuth && pl + 1 < pr && '/' == source . charAt ( pl ) ) { out . append ( "//" ) ; wroteAuth = true ; } out . append ( source , pl , pr ) ; } int ql = ranges . queryLeft ; int qr = ranges . queryRight ; recomposeQuery ( source , ql , qr , out ) ; int fl = ranges . fragmentLeft ; int fr = ranges . fragmentRight ; recomposeFragment ( source , fl , fr , out ) ; }
Appends a scheme specific part onto out using the ranges into source.
Appends a scheme specific part onto out using the ranges into source .
//    System.err.println("al=" + al + ", ar=" + ar + ", this.naturallyHasAuthority=" + this.naturallyHasAuthority); //    System.err.println("wroteAuth=" + wroteAuth); //    System.err.println("source=" + source); //    System.err.println("pl=" + pr); //    System.err.println("pr=" + pl); // Make sure a relative path part doesn't merge into the // authority. // If the path starts with "//" make sure it is not ambiguous with // an authority. //    System.err.println("out=" + out);