解码base64加密的图片并打印到前台
经过base64加密的图片对象是一串字符串,我们解码后可通过流将其打印出来:
utils类:
package com.aebiz.app.web.modules.controllers.open.api.nciccClient.client; import java.awt.Image;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.imageio.ImageIO;
import sun.misc.BASE64Decoder;
public class Util {
/**
* @param p_Str Base64编码的字符窜
* @return byte[]类型的照片信息
* @throws IOException
*/
public static byte[] fromBase64(String p_Str) throws IOException
{
byte[] byteBuffer = new BASE64Decoder().decodeBuffer(p_Str);
return byteBuffer;
}
/**
* @param bytes byte[]类型的照片信息
* @return Java Image对象。可以直接在java程序中绘制到UI界面
*/
public static Image getImage(byte[] bytes) {
Image img = null;
try {
InputStream isPhoto = new ByteArrayInputStream(bytes);
img = ImageIO.read(isPhoto);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return img;
}
}
调用demo:
/**
* 测试用····业务场景不需要
* @param req
* @param response
* @return
*/
@RequestMapping(value = "/getTestResult")
@ResponseBody
public String getTestResult(HttpServletRequest req, HttpServletResponse response) { //将Image 传送到前台进行展示 START
response.setContentType("image/jpeg");// 设置相应类型,告诉浏览器输出的内容为图片
response.setHeader("Pragma", "No-cache");// 设置响应头信息,告诉浏览器不要缓存此内容
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Set-Cookie", "name=value; HttpOnly");//设置HttpOnly属性,防止Xss攻击
response.setDateHeader("Expire", 0); //Base64加密后的图片字符串
String img="/9j/4AAQSkZJRgABAgAAAQABAAD//gAKSFMwMQBFAABbBQBvGQD/2wBDABgQEhUSDxgVExUbGRgcJDwnJCEhJEk0Nys8VkxbWVVMU1Jfa4l0X2WCZ1JTd6J5go2SmZuZXHOotKeVs4mWmZP/2wBDARkbGyQfJEYnJ0aTYlNik5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5P/wAARCADcALIDASIAAhEBAxEB/8QAHwAAAQUBAQEB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BaZMjI6jpQUB5HGe4qJXbavNIwPI3N19aAF2H+9SDKPuUlSejKNu2ooXZuDSzsVCgUAXre6KHbIRt/vBcN+hrRVyRuVty/77D/GsGBy6nJ6VYjkZHCKcKazkjSLNOacRRsWD7vTeSKzJHd+Xdn9gTtpM73Ytz81Ig/eH86cUEncaS2cxgg/XrS5zxJQXYcU8nKtVkjBsPPl/pRmNRggZHqKtuoMKyEAsSBz/ALtVSABwKkBske75lA/KodpbsNtT42tx6dKewHTFUSNjdo14iTDf3qNgLbk+SojIV6AflTS7bwM8GgCXn/nov5UUbFooA//Z";
Util base64=new Util(); byte[]re= new byte[0];
try {
//解码
re = base64.fromBase64(img);
} catch (IOException e) {
e.printStackTrace();
} BufferedImage image=(BufferedImage) base64.getImage(re); try {
// 将内存中的图片通过流动形式输出到客户端
ImageIO.write(image, "JPEG", response.getOutputStream());
if(response.getOutputStream()!= null){
response.getOutputStream().close();
}
} catch (Exception e) {
e.printStackTrace();
}
//将Image 传送到前台进行展示 END
return null;
}
解码base64加密的图片并打印到前台的更多相关文章
- php使用base64加密解密图片
php使用base64加密解密图片的实例代码. 例子: <?php //文件名:base64.php $data="/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAB ...
- base64加密图片处理
场景:下载html中内嵌的base64加密图片 举个例子,博客园的插入图片有两种方式,一是引用图片链接,二是直接粘贴2进制图片文件.以第二种方式的图片则是以base64加密的方式内嵌在html页面中. ...
- java自带BASE64工具进行图片和字符串转换
java自带BASE64工具进行图片和字符串转换 import java.io.File; import java.io.FileInputStream; import java.io.FileOut ...
- BASE64编码的图片在网页中的显示问题的解决
BASE64位转码有两种: 一种是图片转为Base64编码,这种编码是直接可以在页面通过<img src='base64编码'/>的方式显示 Base64 在CSS中的使用 .demoIm ...
- java自带BASE64工具进行图片和字符串转换【转】
java自带BASE64工具进行图片和字符串转换 import java.io.File; import java.io.FileInputStream; import java.io.FileOut ...
- 什么是Base64加密?为什么要有Base64加密?
产生这篇文章的动力在于对接腾讯云服务的时候每次都要进行Base64编码之后才能进行签名,之前只知道Base64是个算法,但是不知道为啥都用这个算法,这次为了链接Base64究竟是个什么东东才在网络上各 ...
- base64格式的图片数据如何转成图片
base64格式的图片数据如何转成图片 一.总结 一句话总结:不仅要去掉前面的格式串,还需要base64_decode()解码才行. // $base_img是获取到前端传递的值 $base_img ...
- Java中处理接口返回base64编码的图片数据
在做接口测试的时候,某些接口返回的content是一大段加密文字.这种情况下,有可能是返回的图片加密数据,需要将这些数据转换成图片进行保存查看. 例如: 这里,可以看到Content对应的键值开头有“ ...
- Java语言实现 Base64 加密 & 解密
Java语言实现 Base64 加密 & 解密 Base64是网络上最常见的用于传输8Bit字节码的编码方式之一,Base64就是一种基于64个可打印字符来表示二进制数据的方法. Base64 ...
随机推荐
- python之OpenCv
1.安装 pip install opencv-python 2.初步简绍 创建窗口显示图像 cv2.namedWindow(窗口名称[,窗口标识]) 例如:cv2.namedWindow(" ...
- go操作redis和mysql示例
一:redis示例 使用redis的包是: github.com/garyburd/redigo/redis 1:编写第一个示例: 链接,设置,获取 redis_basic.go package ma ...
- Zookeeper 集群安装配置
今天,栈长分享下 Zookeeper 的集群安装及配置. 下载 下载地址:http://zookeeper.apache.org/ 下载过程就不说了,我们下载了最新的zookeeper-3.4.11. ...
- python自动化开发-[第二十天]-form表单,CBV和FBV,序列化
1.CBV和FBV的用法 2.序列化用法 3.form表单 一.CBV和FBV 1.cbv是 class based view(基于类),fbv是function based view(基于函数) 2 ...
- linux 优化(一)
uptime up 表示系统正在运行 10:54:19 表示当前时间 8 min 表示系统启动的总时间 1 user 表示正在登陆用户数 load average 表示系统平均负载,最后三个数字呢,依 ...
- SpringBoot笔记十七:热部署
目录 什么是热部署 Devtools热部署 什么是热部署 热部署,就是在应用正在运行的时候升级软件,却不需要重新启动应用. 举个例子,王者荣耀的更新有时候就是热部署,热更新,就是他提示你更新,更新40 ...
- JAVA核心技术I---JAVA基础知识(类的继承)
一:基本概念同C++一致 二:继承演示 .将共同点提取出来,即形成了父类/基类/超类 –Parent class/Base class/Super class .而其他类则自动成为子类/派生类 –Ch ...
- MySQLMySql免安装版安装配置
MySql免安装版安装配置,附MySQL服务无法启动解决方案 mysql 5.6.17 绿色版(免安装)安装配置教程 [mysql] # 设置mysql客户端默认字符集 default-charact ...
- 058、flannel概述(2019-03-27 周三)
参考https://www.cnblogs.com/CloudMan6/p/7412150.html flannel 是 CentOS开发的容器网络解决方案.flannel 为每个host分配一个 ...
- Python数据挖掘和机器学习
-----------------------------2017.8.9--------------------------------- 先占个坑 在接下来的一个半月里(即从现在到十一) 我将结合 ...