/** * Decodes the input base64 encoded String. * The resulting binary data is returned as an array of bytes. * * @param encodedString The base64 encoded String object. * * @return The decoded byte array. */ public static final byte[] decode(String encodedString) { char[] c = new char[encodedString.length()]; encodedString.getChars(0, encodedString.length(), c, 0); return decode(c); }
/** * Adds a base64 encoded value to the attribute. * The value will be decoded and stored as bytes. Character * data encoded as a base64 value must be UTF-8 characters. * * @param attrChars The base64 value of the attribute as an array of * characters. * * @throws IllegalArgumentException if attrString is null */ public void addBase64Value(char[] attrChars) { if( attrChars == null) { throw new IllegalArgumentException("Attribute value cannot be null"); } this.add( Base64.decode(attrChars)); return; }
/** * Adds a base64 encoded value to the attribute. * The value will be decoded and stored as bytes. String * data encoded as a base64 value must be UTF-8 characters. * * @param attrString The base64 value of the attribute as a String. * * @throws IllegalArgumentException if attrString is null */ public void addBase64Value(String attrString) { if( attrString == null) { throw new IllegalArgumentException("Attribute value cannot be null"); } this.add( Base64.decode(attrString)); return; }
/** * Adds a base64 encoded value to the attribute. * The value will be decoded and stored as bytes. Character * data encoded as a base64 value must be UTF-8 characters. * * @param attrString The base64 value of the attribute as a StringBuffer. * @param start The start index of base64 encoded part, inclusive. * @param end The end index of base encoded part, exclusive. * * @throws IllegalArgumentException if attrString is null */ public void addBase64Value(StringBuffer attrString, int start, int end) { if( attrString == null) { throw new IllegalArgumentException("Attribute value cannot be null"); } this.add( Base64.decode(attrString, start, end)); return; }
protected void endElement() { try { byte[] temp; String name = getName(); String value = getValue(); if (this.isBase64) { temp = Base64.decode(value); } else { temp = value.getBytes("UTF-8"); } //getParent().addValue("value", temp); getParent().addValue(name, temp); } catch (UnsupportedEncodingException e) { } } protected void handleAttributes(Attributes attributes) throws SAXException {
this.bytes = Base64.decode(dnField, 4, dnField.length()); try { this.entryDN = new String(this.bytes, "UTF-8");
this.bytes = Base64.decode(chars);
String temp = value.toString(); requestValue = Base64.decode(temp); } else { requestValue = value.toString().getBytes("UTF-8"); case X_VALUE : state = EXTENDED_REQUEST; requestValue = Base64.decode(value, 0, value.length()); break; case FILTER : byte[] temp; if (this.isBase64) { temp = Base64.decode(value, 0, value.length()); } else { temp = value.toString().getBytes("UTF-8"); attributeValues.add(Base64.decode(value, 0, value.length())); } else {