import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import sun.misc.BASE64Decoder; public String getPicFromStreams() { String str ;//存放二进制的流 BASE64Decoder decoder=new BASE64Decoder(); byte[] bytes; try { bytes = decoder.decodeBuffer(str); File file=new File("E:/MYTESTPIC.jpeg"); FileOutputStream fos=new FileOutputStream(file); fos.write(bytes); fos.flush(); fos.close(); } catch (IOException e) { e.printStackTrace(); } return null; }
java 二进制流转换为图片
时间: 2024-11-05 16:08:39