如何在java中将blob图像转换为binarybase64? [英] How to convert blob image into binarybase64 in java?

查看:615
本文介绍了如何在java中将blob图像转换为binarybase64?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有来自DB的blob格式的图像,我在字节数组中保存blob图像并将其转换为二进制Base64格式。

I have image in blob format from DB , i am holding that blob image in byte array and converting it to Binary Base64 format.

用于将blob编码为二进制base 64我正在使用下面的代码,

For encoding the blob to binary base 64 I am using below code,

 byte[] imageByte = getblob();//from DB
 byte[] encodedImage = Base64.encodeBase64(imageByte);

有没有其他办法可以做到这一点或正在以正确的方式做到这一点请帮帮我?

is there any other way to do it or am doing it in right way please help me?

推荐答案

试用此代码:

   String imgString = Base64.encodeToString(bytes, 
                   Base64.NO_WRAP);

这篇关于如何在java中将blob图像转换为binarybase64?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆