• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reg. - Buffered Image

 
shanthi shanmugam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I want to transfer a buffered image from a client machine to my server. I want to know whether it is possible through RMI. I need some suggestions too.
Thank you
Regards
shanthi
 
Ashwin Desai
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If you are referring to the class java.awt.BufferedImage, then you cannot pass that using RMI because this class does not implement Serializable. Also, this class is platform dependent.
Solution I:
-----------
is to pass around the image data in form of bytes[] and any other parameters that would help the client to assemble the image on the client side.
Also, I am not sure if the Image class or any other class provides a constructor to construct an Image from bytes. If it does the above method would work fine.
If not, get the bytes stream and write it to a file at the client side and load the image using Toolkit.getToolkit().getImage(String file name).
Will not work with applet clients.
Solution II:
--------------
A simpler way would be to generate the image on the server side and pass the URL to the client via a method call. The client then uses this URL to load the image using Toolkit.getToolkit().getImage(URL url). If the client is an applet, use the corresponding applet function.
Hope this helps.
Ashwin.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!