mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
04.29.2012 a401798e5e8f3142b49858c958bfcb9d4a764ddb
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/ByteString.java
@@ -34,6 +34,8 @@
import java.util.Arrays;
import java.util.logging.Level;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import com.forgerock.opendj.util.StaticUtils;
/**
@@ -140,6 +142,23 @@
    }
    /**
     * Returns a byte string containing the Base64 decoded bytes of the provided
     * string.
     *
     * @param s
     *            The string to use.
     * @return The byte string containing the Base64 decoded bytes of the
     *         provided string.
     * @throws LocalizedIllegalArgumentException
     *             If the provided string does not contain valid Base64 encoded
     *             content.
     * @see #toBase64String()
     */
    public static ByteString valueOfBase64(final String s) {
        return Base64.decode(s);
    }
    /**
     * Returns a byte string containing the contents of the provided byte array.
     * <p>
     * This method differs from {@link #wrap(byte[])} in that it defensively
@@ -531,6 +550,13 @@
    /**
     * {@inheritDoc}
     */
    public String toBase64String() {
        return Base64.encode(this);
    }
    /**
     * {@inheritDoc}
     */
    public byte[] toByteArray() {
        return copyTo(new byte[length]);
    }