回覆列表
  • 1 # 使用者7169188564904

    import sun.misc.BASE64Encoder;

    import sun.misc.BASE64Decoder;

    // 將 s 進行 BASE64 編碼

    public static String getBASE64(String s) {

    if (s == null) return null;

    return (new sun.misc.BASE64Encoder()).encode( s.getBytes() );

    }

    // 將 BASE64 編碼的字串 s 進行解碼

    public static String getFromBASE64(String s) {

    if (s == null) return null;

    BASE64Decoder decoder = new BASE64Decoder();

    try {

    byte[] b = decoder.decodeBuffer(s);

    return new String(b);

    } catch (Exception e) {

    return null;

    }

    }

  • 中秋節和大豐收的關聯?
  • 創業做什麼比較好?