Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Buffered Images to Input Streams

 
Jeff Storey
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi - I'm trying to write the contents of a BufferedImage for reading by another class that requires an InputStream. The only way I have been able to figure out how to do this so far is to write the image to a temporary file and then read it into the object stream (note the image is created during run-time so I cannot just read the image file in since it does not exist until I write it out). Is there an easier way to do this where I don't have to actually write the file out?

Thanks.
Jeff
 
Brian Cole
Author
Ranch Hand
Posts: 906
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you could use ByteArrayInputStream and ByteArrayOutputStream.
 
Jeff Storey
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll give that a try. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic