Why didn't SUN do that!!!!!!
Has anyone else already done this?
Code is what I need!
Main Topics
Browse All TopicsI have writen a server, client program which sends objects. It passes Strings OK but if you try and pump an Image through as an object it comes up with a NotSerializable exception.
How can I make my image serialisable!! Or how else can I send My image.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
mmhh ...
its not that easy...
first of all you have to derive from BufferedImage instead of deriving from Image, cause Image has several abstracts methodes which want to be overridden ... :(
I try to serialize a BufferedImage derived class but its seams that only the Object and not the Image data will be serailized ( saved it as file: only 1kB )
think you have to serialize the image bits seperate...
nil_dib
>> class MyImg extends Image implements Serializable
Hmm, interesting... nil_dib, are you aware you will have to implement all the abstract methods of class Image or your MyImg will have to be abstract too? And even then you will have to direct way of getting a MyImg from an Image object?
>> Why didn't SUN do that!!!!!!
Because class Image is abstract, its actual implementation may or may not allow Serialization.
What I suggest for you to use is create an array from your image using java.awt.image.PixelGrabbe
Sasha_Mapa,
> ...implement all the abstract methods
I see I see .. ( comment above )
BTW: when you are familiar with images/graphics take a look at http://www.experts-exchang
:)
nil_dib
First, if you can get the raw bytes for the gif or jpg image, I would suggest send those instead of the bytes created from the PixelGrabber... you will be sending compressed data instead. Otherwise as people suggested above,grabbing the pixels and sending the bytes will work as well.
The other option, if you are using Swing, is to Send an ImageIcon object which is Serializable.
Yep it worked eventually.
Took me a while, It was simple to convert to an Integer array, but then writing the array was hard, I had to create a loop, wich was emensly slow, then I created a vetor and sent the vector which was much quicker, If you were thinking diferrently, (ie a faster method) I would still apreciate your coments. (ie I still have a loop creating the vector!)
Business Accounts
Answer for Membership
by: nil_dibPosted on 2000-05-12 at 03:58:32ID: 2804005
what about deriving your own class from java.awt.Image and implement the Serailizable interface ... ?!
class MyImg extends Image implements Serializable
{ ...
nil_dib