BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   How to store an image as byte array in a file? (http://www.blackberryforums.com/developer-forum/87570-how-store-image-byte-array-file.html)

pa4o85 07-25-2007 08:37 AM

How to store an image as byte array in a file?
 
I hava byte array that is corresponding to an image (.jpeg or .png), so i want to make an image file on the device (for example image.jpeg or image.png to be stored in the path: "file:///SDCard/images/")..When i open the image.jpeg to see the image...Do you know how...Give me some code or classes to use...i use JDE 4.2.0..Thank you !

Rose 08-06-2007 12:11 AM

Hi,
This can be done using javaME Fileconnection api.


1) Open a file connection specifying the filepath where you wanna create the image.


FileConnection fp = (FileConnection)Connector.open("FilePath");
if(!fp.exists()){
fp.create();
OutputStream out = fp.openOutputStream();
out.write(imageBytes);
fp.close();
out.close();
}


All times are GMT -5. The time now is 08:01 AM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.