/** * Decodes a Base64 encoded String into a newly-allocated byte array * using the {@link Base64} encoding scheme. * * <p> An invocation of this method has exactly the same effect as invoking * {@code decode(src.getBytes(StandardCharsets.ISO_8859_1))} * * @param src * the string to decode * * @return A newly-allocated byte array containing the decoded bytes. * * @throws IllegalArgumentException * if {@code src} is not in valid Base64 scheme */ public byte[] decode(String src) { return decode(src.getBytes(Charset.forName("ISO-8859-1"))); }
/** * Decodes all bytes from the input byte array using the {@link Base64} * encoding scheme, writing the results into a newly-allocated output * byte array. The returned byte array is of the length of the resulting * bytes. * * @param src * the byte array to decode * * @return A newly-allocated byte array containing the decoded bytes. * * @throws IllegalArgumentException * if {@code src} is not in valid Base64 scheme */ public byte[] decode(byte[] src) { byte[] dst = new byte[outLength(src, 0, src.length)]; int ret = decode0(src, 0, src.length, dst); if (ret != dst.length) { dst = Arrays.copyOf(dst, ret); } return dst; }
/** * Decodes all bytes from the input byte array using the {@link Base64} * encoding scheme, writing the results into a newly-allocated output * byte array. The returned byte array is of the length of the resulting * bytes. * * @param src * the byte array to decode * * @return A newly-allocated byte array containing the decoded bytes. * * @throws IllegalArgumentException * if {@code src} is not in valid Base64 scheme */ public byte[] decode(byte[] src) { byte[] dst = new byte[outLength(src, 0, src.length)]; int ret = decode0(src, 0, src.length, dst); if (ret != dst.length) { dst = Arrays.copyOf(dst, ret); } return dst; }
/** * Decodes a Base64 encoded String into a newly-allocated byte array * using the {@link Base64} encoding scheme. * * <p> An invocation of this method has exactly the same effect as invoking * {@code decode(src.getBytes(StandardCharsets.ISO_8859_1))} * * @param src * the string to decode * * @return A newly-allocated byte array containing the decoded bytes. * * @throws IllegalArgumentException * if {@code src} is not in valid Base64 scheme */ public byte[] decode(String src) { return decode(src.getBytes(Charset.forName("ISO-8859-1"))); }
/** * Decodes a Base64 encoded String into a newly-allocated byte array * using the {@link Base64} encoding scheme. * * <p> An invocation of this method has exactly the same effect as invoking * {@code decode(src.getBytes(StandardCharsets.ISO_8859_1))} * * @param src * the string to decode * * @return A newly-allocated byte array containing the decoded bytes. * * @throws IllegalArgumentException * if {@code src} is not in valid Base64 scheme */ public byte[] decode(String src) { return decode(src.getBytes(Charset.forName("ISO-8859-1"))); }
/** * Will decode Base64-encoded string back into byte array. * * @param input Base64-encoded string. * @return byte array decoded from string. */ public static byte[] fromBase64(String input) { return Base64.getDecoder().decode(input); } }
/** * Will decode Base64-encoded string back into byte array. * * @param input Base64-encoded string. * @return byte array decoded from string. */ public static byte[] fromBase64(String input) { return Base64.getDecoder().decode(input); }
/** * Decodes all bytes from the input byte array using the {@link Base64} * encoding scheme, writing the results into a newly-allocated output * byte array. The returned byte array is of the length of the resulting * bytes. * * @param src * the byte array to decode * * @return A newly-allocated byte array containing the decoded bytes. * * @throws IllegalArgumentException * if {@code src} is not in valid Base64 scheme */ public byte[] decode(byte[] src) { byte[] dst = new byte[outLength(src, 0, src.length)]; int ret = decode0(src, 0, src.length, dst); if (ret != dst.length) { dst = Arrays.copyOf(dst, ret); } return dst; }
/** * Will decode Base64-encoded string back into byte array. * * @param input Base64-encoded string. * @return byte array decoded from string. */ public static byte[] fromBase64(String input) { return Base64.getDecoder().decode(input); }