/** * Same as {@link #encode(byte[], int, int)} but accepts an array of boxed * Byte values. * * @param data * The sequence of bytes to encode. Every element must be non-null. * @param off * The offset into the data array to start encoding from * @param length * The number of bytes to encode, starting from {@code off} * * @return The base64 encoded data. */ public static String encode(final Byte[] data, final int off, final int length) { final byte[] primitiveData = new byte[data.length]; for (int i = 0; i < length; i++) { primitiveData[i] = data[off + i]; } return encode(primitiveData, 0, primitiveData.length); }
/** * Same as {@link #encode(byte[], int, int)} but accepts an array of boxed * Byte values. * * @param data * The sequence of bytes to encode. Every element must be non-null. * @param off * The offset into the data array to start encoding from * @param length * The number of bytes to encode, starting from {@code off} * * @return The base64 encoded data. */ public static String encode(final Byte[] data, final int off, final int length) { final byte[] primitiveData = new byte[data.length]; for (int i = 0; i < length; i++) { primitiveData[i] = data[off + i]; } return encode(primitiveData, 0, primitiveData.length); }
/** * Encodes the specified data-uri string in XML/Base64 format. */ public static String encodeBase64(final String dataUriDecoded) { return SVG_DATA_URI_BASE64 + Base64Util.encode(dataUriDecoded.getBytes(), 0, dataUriDecoded.length()); }