Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Image into serializable object?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm new to Java images/IO. I've an api which gives me Image object, All I need to do is save the Image onto the server. So, Applet gets an image from the sanner api, the api returns Image object. I need to serialize this and send this to the servlets. Now the servlet has to save this onto the filesystem. Could you help me through this process?
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try wrapping the Image object in an ImageIcon object which does implement Serializable.

http://download.oracle.com/javase/1.5.0/docs/api/javax/swing/ImageIcon.html
 
Sheriff
Posts: 21971
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or use ImageIO to turn the image into a byte[]. Use ByteArrayOutputStream and ByteArrayInputStream as intermediaries.
    Bookmark Topic Watch Topic
  • New Topic