简体   繁体   English

如何将 SQL 图像数据类型转换为 java 中的 base64 字符串

[英]How to convert the SQL image datatype to base64 string in java

i was trying to create the file from the database file content is stored in sql image datatype field, as per few blogs data stored in image datatype is binary format but when I tried to convert them into base64 string it throwing errors(i have used online tools).我试图从数据库中创建文件文件内容存储在 sql 图像数据类型字段中,因为存储在图像数据类型中的一些博客数据是二进制格式,但是当我尝试将它们转换为 base64 字符串时,它会抛出错误(我在网上使用过工具)。 Is there any example code that can help me out.有没有可以帮助我的示例代码。

Sample file content示例文件内容

The image data type corresponds to the byte[] type in Java. image数据类型对应Java中的byte[]类型。

You can use java.util.Base64 to convert byte[] to Base64 encoded String .您可以使用java.util.Base64byte[]转换为 Base64 编码的String

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM