/** * Tests a given byte array to see if it contains only valid characters within the Base64 alphabet. Currently the * method treats whitespace as valid. * * @param base64Bytes byte array to test * @return <code>true</code> if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; * <code>false</code>, otherwise */ public static boolean isBase64(byte[] base64Bytes) { if (null == base64Bytes) { return false; } for (int i = 0; i < base64Bytes.length; i++) { if (!isBase64(base64Bytes[i]) && !isWhiteSpace(base64Bytes[i])) { return false; } } return true; }