public String encodeBase64() throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder(); if (username != null) { if (username.indexOf(':') != -1) throw new UnsupportedEncodingException("Username cannot contain ':' characters: " + username); sb.append(username); } sb.append(':'); if (username != null) sb.append(password); return Base64.encodeToString(sb.toString().getBytes(charset.name()), false); }
public String encodeBase64() throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder(); if (username != null) { if (username.indexOf(':') != -1) throw new UnsupportedEncodingException("Username cannot contain ':' characters: " + username); sb.append(username); } sb.append(':'); if (username != null) sb.append(password); return Base64.encodeToString(sb.toString().getBytes(charset.name()), false); }
public String encodeBase64() throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder(); if (username != null) { if (username.indexOf(':') != -1) throw new UnsupportedEncodingException("Username cannot contain ':' characters: " + username); sb.append(username); } sb.append(':'); if (username != null) sb.append(password); return Base64.encodeToString(sb.toString().getBytes(charset.name()), false); }