第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

java實現(xiàn)Base64~~~~繼續(xù)加油?。?!

標(biāo)簽:
Java

跟着老师一起敲打的,感觉还是很神奇哦!!!
注意啦:sun.misc.BASE64Encoder找不到jar包的解决方法
1.右键项目-》属性-》Java bulid path-》jre System Library-》access rules-》resolution选择accessible,下面填上** 点击确定即可!!!
2.
在MyEclipse中编写Java代码时,用到了BASE64Decoder,import sun.misc.BASE64Decoder;可是Eclipse提示:
Access restriction: The type BASE64Decoder is not accessible due to restriction on required library C:\Program
files\java\jre6\lib\rt.jar
Access restriction : The constructor BASE64Decoder() is not accessible due to restriction on required library C:\Program files\java\jre6\lib\rt.jar

解决方案1(推荐):
只需要在project build path中先移除JRE System Library,再添加库JRE System Library,重新编译后就一切正常了。
解决方案2:
Windows -> Preferences -> Java -> Compiler -> Errors/Warnings ->
Deprecated and trstricted API -> Forbidden reference (access rules): -> change to warning

import java.io.IOException;

import org.apache.commons.codec.binary.Base64;
import org.bouncycastle.jcajce.provider.symmetric.ARC4.Base;
import org.bouncycastle.util.encoders.Base64Encoder;
import sun.security.*;
import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;
public class loveBase64 {
    private static String class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="immoc security base64";
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        //jdkbase64();
        //commonsCodesBase64();
        bouncyCastleBase64();
    }
    public static void jdkbase64(){

        try {
            BASE64Encoder encoder=new BASE64Encoder(); 
        String encode=encoder.encode(src.getBytes());
        System.out.println("encode:"+encode);
        BASE64Decoder decoder=new BASE64Decoder(); 
        System.out.println("decode:"+new String(decoder.decodeBuffer(encode)));

        } catch (IOException e) {
            // TODO: handle exception
        }
    }

    public static void commonsCodesBase64(){
        byte[] encodeBytes=Base64.encodeBase64(src.getBytes());
        System.out.println("encode:"+new String(encodeBytes));
        byte[] decodeBytes=Base64.decodeBase64(encodeBytes);
        System.out.println("decode:"+new String(decodeBytes));
    }

    public static void bouncyCastleBase64(){
       byte[] encodeBytes=org.bouncycastle.util.encoders.Base64.encode(src.getBytes());
       System.out.println("encode:"+new String(encodeBytes));
       byte[] decodeBytes=org.bouncycastle.util.encoders.Base64.decode(encodeBytes);
       System.out.println("decode:"+new String(decodeBytes));
    }

}
點擊查看更多內(nèi)容
1人點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質(zhì)文章

正在加載中
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學(xué)

大額優(yōu)惠券免費領(lǐng)

立即參與 放棄機會
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

舉報

0/150
提交
取消