sprockets/src/main/java/net/sf/sprockets/net/Uris.java
public static Uri mailto(List<String> to, List<String> cc, List<String> bcc, String subject,
                             String body) {
        String encSubject = Uri.encode(subject);
        String encBody = Uri.encode(body);
        StringBuilder ssp = new StringBuilder(
                CollectionUtils.size(to) * 34 + CollectionUtils.size(cc) * 34 +
                        CollectionUtils.size(bcc) * 34 + StringUtils.length(encSubject) +
                        StringUtils.length(encBody));
        Joiner joiner = Joiner.on(',');
        if (CollectionUtils.isNotEmpty(to)) {
            joiner.appendTo(ssp, to);
        }
        boolean start = true;
        if (CollectionUtils.isNotEmpty(cc)) {
            //noinspection ConstantConditions
            joiner.appendTo(ssp.append(separator(start)).append("cc="), cc);
            start = false;
        }
        if (CollectionUtils.isNotEmpty(bcc)) {
            joiner.appendTo(ssp.append(separator(start)).append("bcc="), bcc);
            start = false;
        }
        if (!TextUtils.isEmpty(encSubject)) {
            ssp.append(separator(start)).append("subject=").append(encSubject);
            start = false;
        }
        if (!TextUtils.isEmpty(encBody)) {
            ssp.append(separator(start)).append("body=").append(encBody);
            //noinspection UnusedAssignment
            start = false;
        }
        return new Builder().scheme("mailto").encodedOpaquePart(ssp.toString()).build();
    }
public static Uri mailto(List<String> to, List<String> cc, List<String> bcc, String subject,
                             String body) {
        String encSubject = Uri.encode(subject);
        String encBody = Uri.encode(body);
        StringBuilder ssp = new StringBuilder(
                CollectionUtils.size(to) * 34 + CollectionUtils.size(cc) * 34 +
                        CollectionUtils.size(bcc) * 34 + StringUtils.length(encSubject) +
                        StringUtils.length(encBody));
        Joiner joiner = Joiner.on(',');
        if (CollectionUtils.isNotEmpty(to)) {
            joiner.appendTo(ssp, to);
        }
        boolean start = true;
        if (CollectionUtils.isNotEmpty(cc)) {
            //noinspection ConstantConditions
            joiner.appendTo(ssp.append(separator(start)).append("cc="), cc);
            start = false;
        }
        if (CollectionUtils.isNotEmpty(bcc)) {
            joiner.appendTo(ssp.append(separator(start)).append("bcc="), bcc);
            start = false;
        }
        if (!TextUtils.isEmpty(encSubject)) {
            ssp.append(separator(start)).append("subject=").append(encSubject);
            start = false;
        }
        if (!TextUtils.isEmpty(encBody)) {
            ssp.append(separator(start)).append("body=").append(encBody);
            //noinspection UnusedAssignment
            start = false;
        }
        return new Builder().scheme("mailto").encodedOpaquePart(ssp.toString()).build();
    }
public static Uri mailto ( List < String > to , List < String > cc , List < String > bcc , String subject , String body ) { String encSubject = Uri . encode ( subject ) ; String encBody = Uri . encode ( body ) ; StringBuilder ssp = new StringBuilder ( CollectionUtils . size ( to ) * 34 + CollectionUtils . size ( cc ) * 34 + CollectionUtils . size ( bcc ) * 34 + StringUtils . length ( encSubject ) + StringUtils . length ( encBody ) ) ; Joiner joiner = Joiner . on ( ' ' ) ; if ( CollectionUtils . isNotEmpty ( to ) ) { joiner . appendTo ( ssp , to ) ; } boolean start = true ; if ( CollectionUtils . isNotEmpty ( cc ) ) { //noinspection ConstantConditions joiner . appendTo ( ssp . append ( separator ( start ) ) . append ( "cc=" ) , cc ) ; start = false ; } if ( CollectionUtils . isNotEmpty ( bcc ) ) { joiner . appendTo ( ssp . append ( separator ( start ) ) . append ( "bcc=" ) , bcc ) ; start = false ; } if ( ! TextUtils . isEmpty ( encSubject ) ) { ssp . append ( separator ( start ) ) . append ( "subject=" ) . append ( encSubject ) ; start = false ; } if ( ! TextUtils . isEmpty ( encBody ) ) { ssp . append ( separator ( start ) ) . append ( "body=" ) . append ( encBody ) ; //noinspection UnusedAssignment start = false ; } return new Builder ( ) . scheme ( "mailto" ) . encodedOpaquePart ( ssp . toString ( ) ) . build ( ) ; }
Get a {@code mailto} Uri with the headers. Any null or empty parameters are skipped. The
subject and body will be encoded.
Get a {