社区
Java
帖子详情
怎样对图片base64解码?
youngmean
2005-02-02 05:48:41
BASE64Decoder decoder = new BASE64Decoder();
File f = new File("what.gif");
FileOutputStream fos = new FileOutputStream(f);
byte[] buf = decoder.decodeBuffer(strBase64);
fos.write(buf);
fos.close();
不行呀!!怎么做?????
...全文
527
5
打赏
收藏
怎样对图片base64解码?
BASE64Decoder decoder = new BASE64Decoder(); File f = new File("what.gif"); FileOutputStream fos = new FileOutputStream(f); byte[] buf = decoder.decodeBuffer(strBase64); fos.write(buf); fos.close(); 不行呀!!怎么做?????
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
yyil80
2010-06-23
打赏
举报
回复
学习了。
GJA106
2005-02-03
打赏
举报
回复
编码代码:
FileInputStream fileForInput = new FileInputStream("c:\\test.gif");
String content = new String();
byte[] bytes = new byte[fileForInput.available()];
fileForInput.read(bytes);
content = new sun.misc.BASE64Encoder().encode(bytes); //具体的编码方法
fileForInput.close();
解码代码:
str = "";//编码内容
byte[] result =new sun.misc.BASE64Decoder().decodeBuffer(str.trim());
RandomAccessFile inOut = new RandomAccessFile("c:\\my.jpg","rw");
inOut.write(result);
inOut.close();
youngmean
2005-02-02
打赏
举报
回复
这样好像有问题ya!:
public static String base64Decode(String base64Src){
String r = "";
try{
BASE64Decoder decoder = new BASE64Decoder();
byte[] buf = decoder.decodeBuffer(base64Src);
r = new String(buf);
}catch(Exception e){
e.printStackTrace();
}
return r;
}
GJA106
2005-02-02
打赏
举报
回复
如果what.gif是在当前jvm默认路径下File f = new File("what.gif");就起作用,否则使用绝对路径来完成文件定位。如:File f = new File("d:\\images\\what.gif");
youngmean
2005-02-02
打赏
举报
回复
what.gif打不开
labview
图片
缩放
base64
编码
base64
解码
labview
图片
缩放
base64
编码
base64
解码
BASE64
图片
解码
_
解码
_vba
图片
base64
_
base64
_VBa_
图片
_
在Excel中用VBA
解码
BASE64
编码的
图片
图片
base64
、gzip编码及
解码
编码:
图片
经过
base64
编码,再进行gzip压缩。
解码
:gzip解压,
base64
解码
。
二维码生成
图片
Base64
编码
解码
1.Java生成二维码示例 2.
图片
保存到本地或生成
Base64
编码 3.
Base64
编码生成
图片
base64
编码
解码
离线工具
base64
编码
解码
离线工具,不需要联网,适用于windows,自己开发的一个小工具,比较简陋,优化了一下功能,能够解释显示换行符
Java
50,530
社区成员
85,610
社区内容
发帖
与我相关
我的任务
Java
Java相关技术讨论
复制链接
扫一扫
分享
社区描述
Java相关技术讨论
java
spring boot
spring cloud
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章