I want to fetch an image from database. For that I have created a byte array for an image, which is passed by a string, and now I want to convert that string into image format. I am assigning that image to a Jlabel field. The code is as follows:
try {
Blob image_vis = (10);
InputStream x=image_vis.getBinaryStream();
OutputStream out=new FileOutputStream(string_op);
byte[] bytes = string_op.getBytes();
String s=new String(bytes);
(+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
}
解决方案Blob blob = new (bytes);