-1
從字節數組到圖像的圖像轉換代碼,即blob。在java中將字節數組轉換爲圖像(blob)
try
{
Blob image_vis = rs1.getBlob(10);
InputStream x=image_vis.getBinaryStream();
OutputStream out=new FileOutputStream(string_op);
byte[] bytes = string_op.getBytes();
String s=new String(bytes);
System.out.println(+s); //prints bytes for the string
ImageIcon icon_cap = new ImageIcon(string_op);
image_cap.setIcon(icon_cap); //prints nothing to Jlabel
//image_cap.setText(s); //prints a path of a image
}
我能夠得到的圖像的路徑,但我ANABLE將其轉換成圖像格式,這樣它會顯示在窗體上。請幫幫我。
請不要重複你的問題。 http://stackoverflow.com/questions/10849893/javahow-to-convert-byte-array-to-blob –
我無法找到解決方案,這就是爲什麼.... :( – Anjali