- byte[] sfile = getBytes("D:\\4.png");
- Base64 base64 = new Base64();
- byte[] a=base64.encode(sfile);
- try {
- String str = new String(a,"utf-8");
- System.out.println("字符串长度:"+str.length());
- byte[] xml=str.getBytes("UTF-8");
- byte[] b=base64.decode(xml);
- setFile(b, "c:\\", "4.png");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- //该片段来自于http://www.codesnippet.cn/detail/1102201511758.html
来源: http://www.codesnippet.cn/detail/1102201511758.html