/** * Encode a string using Base64 encoding * * @param str the string to be encoded * @return encoded string */ public static String encodeBASE64(String str) { return Codec.encodeBase64(str); }
/** * Encode a string using Base64 encoding * * @param str the string to be encoded * @return encoded string */ public static String encodeBASE64(String str) { return Codec.encodeBase64(str); }
/** * Encode binary data to base64 * * @param value The binary data * @return The base64 encoded String * @deprecated Use {@link #encodeBase64(byte[])} instead */ @Deprecated public static String encodeBASE64(byte[] value) { return encodeBase64(value); }
/** * Encode binary data to base64 * * @param value The binary data * @return The base64 encoded String * @deprecated Use {@link #encodeBase64(byte[])} instead */ @Deprecated public static String encodeBASE64(byte[] value) { return encodeBase64(value); }
/** * Encode an image to base64 using a data: URI * * @param bytes The image byte array * @param mimeType the mime type, if not specified then default to {@link #DEF_MIME_TYPE} * @return The base64 encoded value */ public static String toBase64(byte[] bytes, String mimeType) { return "data:" + mimeType(mimeType) + ";base64," + Codec.encodeBase64(bytes); }
/** * Encode an image to base64 using a data: URI * * @param bytes The image byte array * @param mimeType the mime type, if not specified then default to {@link #DEF_MIME_TYPE} * @return The base64 encoded value */ public static String toBase64(byte[] bytes, String mimeType) { return "data:" + mimeType(mimeType) + ";base64," + Codec.encodeBase64(bytes); }