本文介绍了在Java中将字节数组转换为Image对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在oracle数据库中有blob数据,我已将其转换为字节数组.
现在,我需要将此字节数组传递给仅接受Image对象的函数.
我想知道如何将字节数组转换为Image.
这是我现在用于转换的代码.
I have blob data in oracle database i have converted it to byte array.
Now i need to pass this byte array to a function which accepts only Image object.
I want to know how to convert the byte array to Image.
This is the code that I''m using for conversion right now.
Blob temp;
Image[] tempImg=new Image[1];
temp = rs.getBlob("FACE");
nt blobLength = (int) temp.length();
byte[] blobbytes = temp.getBytes(1, blobLength);
tempImg[0] = new ImageIcon(blobbytes).getImage();
getBlob是用于从数据库获取blob数据的函数.
任何帮助将不胜感激.
在此先谢谢您.
getBlob is the function to get the blob data form the database.
any help will be appreciated.
Thanks in advance.
推荐答案
这篇关于在Java中将字节数组转换为Image对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!