| | |
| | | import java.util.Arrays; |
| | | import java.util.logging.Level; |
| | | |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public String toBase64String() { |
| | | return Base64.encode(this); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public byte[] toByteArray() { |
| | | return copyTo(new byte[length]); |
| | | } |