[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A doubt.. Please



I would use a byte array, possible a HashMap of byte arrays with the image
name (or whatever) as the key.

Something like this:


       HashMap imageMap = new HashMap();

       String fileName = "your/image/file";
       File imageFile = new File(fileName);
       byte[] imageBytes = new byte[new
     Long(imageFile.length()).intValue()];

       try {
       BufferedInputStream imageStream = new BufferedInputStream(new
     FileInputStream(imageFile));
       imageStream.read(imageBytes, 0, imageBytes.length);
       } catch (Exception e) {}

       imageMap.put(fileName, imageBytes);

If imageMap is in a database object, your images will be persisted.

Of course, you could also use the ozone Blob classes, but I haven't any
experience with that.

Nathan Probst



Francisco Nazario Santiago wrote:

>        Nowadays I´m working in a project of a University of Mexico.
> and I need to store images files in an object database so I need to know
> if it is posible do it with Ozone.
> I would like to know what kind of variable do I have to use for that.
>
> Thank you very much.
>
> Francisco
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> m.