NextOne
asked on
How to convert Java Serialisable Object to Byte Array
Hi,
does anybody know how to convert a Java Object like Image Object into a byte[] to do stuff with it after....
For exemple if i create serialisable object and i want to store them in database in byte []
help !
does anybody know how to convert a Java Object like Image Object into a byte[] to do stuff with it after....
For exemple if i create serialisable object and i want to store them in database in byte []
help !
The is a couple of classes in the io package called ByteArrayOutputStream and ByteArrayInputStream. Wrap these with any OutputStream you desire and you have your byte[].
you need
java.awt.image.PixelGrabbe r
java.awt.image.PixelGrabbe
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I prefere the Jim cakalic answer that is full of explenation and very interesting... I gonna try
thanks to everybody
thanks to everybody
ASKER
thanks, i gonna try
>> how to convert a Java Object like Image Object into a byte[]
well - java.awt.Image is not Serializable :)
well - java.awt.Image is not Serializable :)
ASKER
Well yes, but i found a solution, i read directly the file...
But i use a Sybase DataBase and I've a stream problem,
I can only read 32768 bytes...
But i use a Sybase DataBase and I've a stream problem,
I can only read 32768 bytes...