app/src/main/java/com/example/hybss/utils/Base64.java
public static String decode(String data, String charset) {
        if (null == data) {
            return null;
        }
//        if (Build.VERSION.SDK_INT < 8) { 
            if (charset == null) {
                // use default
                return new String(decode(data));
            }

            try {
                return new String(decode(data), charset);
            } catch (UnsupportedEncodingException ex) {
                return new String(decode(data));
            }
//        } else {
//            try {
//                Class<?> c = Class.forName("android.util.Base64");
//                byte byteData[] = ReflectUtils.invokeStatic(byte[].class, c, "decode", new Class[] { String.class,
//                        int.class }, new Object[] { data, c.getField("DEFAULT").get(c) });
//                return new String(byteData, charset);
//            } catch (Exception e) {
//                LogUtils.e(e);
//                return new String(decode(data));
//            }
//        }
    }
/**
     * Decode the string and convert back the decoded value into a string using the specified charset. Use default
     * encoding if charset is null or invalid.
     */
Decode the string and convert back the decoded value into a string using the specified charset. Use default
encoding if charset is null or invalid.
Decode the string and convert back the decoded value into a string using the specified charset . Use default encoding if charset is null or invalid .
public static String decode(String data, String charset) {
        if (null == data) {
            return null;
        }
            if (charset == null) {
                return new String(decode(data));
            }
            try {
                return new String(decode(data), charset);
            } catch (UnsupportedEncodingException ex) {
                return new String(decode(data));
            }
    }
public static String decode ( String data , String charset ) { if ( null == data ) { return null ; } if ( charset == null ) { return new String ( decode ( data ) ) ; } try { return new String ( decode ( data ) , charset ) ; } catch ( UnsupportedEncodingException ex ) { return new String ( decode ( data ) ) ; } }
Decode the string and convert back the decoded value into a string using the specified charset.
Decode the string and convert back the decoded value into a string using the specified charset .
//        if (Build.VERSION.SDK_INT < 8) {  // use default //        } else { //            try { //                Class<?> c = Class.forName("android.util.Base64"); //                byte byteData[] = ReflectUtils.invokeStatic(byte[].class, c, "decode", new Class[] { String.class, //                        int.class }, new Object[] { data, c.getField("DEFAULT").get(c) }); //                return new String(byteData, charset); //            } catch (Exception e) { //                LogUtils.e(e); //                return new String(decode(data)); //            } //        }