File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Buffered Images to Input Streams Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Buffered Images to Input Streams" Watch "Buffered Images to Input Streams" New topic
Author

Buffered Images to Input Streams

Jeff Storey
Ranch Hand

Joined: Oct 09, 2006
Posts: 118
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

Joined: Sep 20, 2005
Posts: 862
Well you could use ByteArrayInputStream and ByteArrayOutputStream.


bitguru blog
Jeff Storey
Ranch Hand

Joined: Oct 09, 2006
Posts: 118
I'll give that a try. Thanks.
 
Don't get me started about those stupid light bulbs.
 
subject: Buffered Images to Input Streams