/** Decodes a BASE64 encoded <code>String</code>. All illegal characters will be ignored and can handle both strings with * and without line separators.<br> * <b>Note!</b> It can be up to about 2x the speed to call <code>decode(str.toCharArray())</code> instead. That * will create a temporary array though. This version will use <code>str.charAt(i)</code> to iterate the string. * @param str The source string. <code>null</code> or length 0 will return an empty array. * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters * (including '=') isn't divideable by 4. (I.e. definitely corrupted). */ public final static byte[] decode(String str) { return decode(str, false); }
/** Decodes a BASE64 encoded <code>String</code>. All illegal characters will be ignored and can handle both strings with * and without line separators.<br> * <b>Note!</b> It can be up to about 2x the speed to call <code>decode(str.toCharArray())</code> instead. That * will create a temporary array though. This version will use <code>str.charAt(i)</code> to iterate the string. * @param str The source string. <code>null</code> or length 0 will return an empty array. * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters * (including '=') isn't divideable by 4. (I.e. definitely corrupted). */ public final static byte[] decode(String str) { return decode(str, false); }
/** Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with * and without line separators. * @param sArr The source array. <code>null</code> or length 0 will return an empty array. * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters * (including '=') isn't divideable by 4. (I.e. definitely corrupted). */ public final static byte[] decode(char[] sArr) { return decode(sArr, false); }
/** Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with * and without line separators. * @param sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception. * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters * (including '=') isn't divideable by 4. (I.e. definitely corrupted). */ public final static byte[] decode(byte[] sArr) { return decode(sArr, false); }
/** Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with * and without line separators. * @param sArr The source array. <code>null</code> or length 0 will return an empty array. * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters * (including '=') isn't divideable by 4. (I.e. definitely corrupted). */ public final static byte[] decode(char[] sArr) { return decode(sArr, false); }
/** Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with * and without line separators. * @param sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception. * @return The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters * (including '=') isn't divideable by 4. (I.e. definitely corrupted). */ public final static byte[] decode(byte[] sArr) { return decode(sArr, false); }