import sun.misc.BASE64Decoder;

    private String getBase64Picture(String imgBase64Str) {
FileOutputStream fos = null;
String uuid = UUID.randomUUID().toString(); String staticPath = "d:/upsoft/test/img/";
String relativePath = "/test/img/"; File cutImgFile = new File(staticPath);
if (!cutImgFile.exists()) {
cutImgFile.mkdirs();
}
String picturePath = staticPath + uuid + ".jpg";
try {
byte[] fileDat = ImageStr2Bytes(imgBase64Str);
File file = new File(picturePath);
fos = new FileOutputStream(file);
fos.write(fileDat);
fos.close(); } catch (Exception e) {
e.printStackTrace();
}
return relativePath + uuid + ".jpg";
} public byte[] ImageStr2Bytes(String imgStr) {
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] b = decoder.decodeBuffer(imgStr);
return b;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}

最新文章

  1. [LeetCode] Multiply Strings 字符串相乘
  2. jasoncpp读取jason数据如何判断某一字段是否存在
  3. List<T>保存为XML文件
  4. linux 打造man中文帮助手册
  5. React学习资料
  6. java.lang.IllegalArgumentException: addChild: Child name '/SSHE' is not unique
  7. JS增删改HTML表格
  8. bss段为什么需要初始化?
  9. JAVA 生成PDF报表()
  10. 【Java】Java垃圾回收机制
  11. Solr4.8.0源码分析(8)之Lucene的索引文件(1)
  12. mac下 配置 Apache Php Mysql
  13. angular ng-bind
  14. Vue-自带vue-resource插件实现http请求
  15. k8s
  16. CodeForces - 589B(暴力+排序)
  17. 洛谷p1732 活蹦乱跳的香穗子 二维DP
  18. k8s资料转载
  19. Spring RedisTemplate操作-xml配置(1)
  20. angularjs中的验证input输入框只能输入数字和小数点

热门文章

  1. 使用CSS如何悬停背景颜色变色 onmouseover、onmouseout
  2. XMPP得知--建立一个管理类
  3. 两个文件中的配置项设置方法和C比较程序处理
  4. sql pivot、unpivot和partition by用法
  5. axWindowsMediaPlayer1获取音频长度
  6. android:强大的图像下载和缓存库Picasso
  7. 【SSH进阶之路】一步步重构容器实现Spring框架——彻底封装,实现简单灵活的Spring框架(十一)
  8. 简单介绍如何使用PowerMock和Mockito来mock 1. 构造函数 2. 静态函数 3. 枚举实现的单例 4. 选择参数值做为函数的返回值(转)
  9. Android使用HttpURLConnection下载图片
  10. n每个计数的概率和发生骰子--动态规划