Java Applet, writing image file to disk from byte[]
-
Hi .. I am new to Java.. I will be getting image Byte array via CORBA.. In the Java Applet I should get the image data and write on to disk in Jpg format. I am trying with below code. but ImageIO.read() fails, no clue why? Could you please advise I AccessController.doPrivileged(new PrivilegedAction() to make to that I has write access and tested writing text file, file is getting created. But the issue was image is not getting created from byte array Pleaes help I just want to create image of any format from m_imgData[] and save it to disk. Thanks in advance !!
InputStream bteArrayInputStream = new ByteArrayInputStream(m\_imgData); final BufferedImage bufferedImage = ImageIO.read(bteArrayInputStream); ImageIO.write(bufferedImage, "jpg", new File("c:\\\\temp\\\\myImg.jpg"));
-
Hi .. I am new to Java.. I will be getting image Byte array via CORBA.. In the Java Applet I should get the image data and write on to disk in Jpg format. I am trying with below code. but ImageIO.read() fails, no clue why? Could you please advise I AccessController.doPrivileged(new PrivilegedAction() to make to that I has write access and tested writing text file, file is getting created. But the issue was image is not getting created from byte array Pleaes help I just want to create image of any format from m_imgData[] and save it to disk. Thanks in advance !!
InputStream bteArrayInputStream = new ByteArrayInputStream(m\_imgData); final BufferedImage bufferedImage = ImageIO.read(bteArrayInputStream); ImageIO.write(bufferedImage, "jpg", new File("c:\\\\temp\\\\myImg.jpg"));