概念
創(chuàng)新互聯(lián)公司專注于建甌企業(yè)網站建設,響應式網站設計,商城網站建設。建甌網站建設公司,為建甌等地區(qū)提供建站服務。全流程按需規(guī)劃網站,專業(yè)設計,全程項目跟蹤,創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務
示例一
org.apache.httpcomponents httpclient 4.5.6
public static void main(String[] args) throws UnsupportedEncodingException { String str = "PERJVj53d2RhZGZhZGYgYXNkZmFzZiBhc2Zhc2QgZnNhZGZmYTwvRElWPg=="; String decodeStr = new String(Base64.decodeBase64(str),"GBK"); System.out.println(decodeStr); }
示例二
// 項目 www.1b23.com public class Base64 { private static final char[] S_BASE64CHAR = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; private static final char S_BASE64PAD = '='; private static final byte[] S_DECODETABLE = new byte[128]; static { for (int i = 0; i> 4 & 0x3); return 1; case 2: obuf[wp++] = (byte)(b0 <<2 & 0xfc | b1>> 4 & 0x3); obuf[wp] = (byte)(b1 <<4 & 0xf0 | b2>> 2 & 0xf); return 2; case 3: obuf[wp++] = (byte)(b0 <<2 & 0xfc | b1>> 4 & 0x3); obuf[wp++] = (byte)(b1 <<4 & 0xf0 | b2>> 2 & 0xf); obuf[wp] = (byte)(b2 <<6 & 0xc0 | b3 & 0x3f); return 3; default: throw new RuntimeException("Internal Errror"); } } public static byte[] decode(String data) { char[] ibuf = new char[4]; int ibufcount = 0; byte[] obuf = new byte[data.length()/4*3+3]; int obufcount = 0; for (int i = 0; i public static void main(String[] args) throws UnsupportedEncodingException { String str = "PERJVj53d2RhZGZhZGYgYXNkZmFzZiBhc2Zhc2QgZnNhZGZmYTwvRElWPg=="; String decodeStr = new String(Base64.decode(str),"GBK"); System.out.println(decodeStr); }
名稱欄目:base64實現解碼轉化的方法
URL分享:http://weahome.cn/article/gghdhh.html