| Author |
BufferedImage from FileOutputStream
|
RoshaniG Gopal
Ranch Hand
Joined: May 15, 2006
Posts: 180
|
|
Hi All, i want to get a BufferedImage but I have a FileOutputStream Object with me. Can anyone tell how do I get it?
|
Regards,<br />Roshani
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12911
|
|
A FileOutputStream is for writing to a file. Did you mean you have a FileInputStream object, for reading from a file? The easiest way to read an image from a file is using the ImageIO API:
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
RoshaniG Gopal
Ranch Hand
Joined: May 15, 2006
Posts: 180
|
|
Hi Jesper, Thanks for your reply adn apology if I was not clear in my question. I have a FileOutputStream object adn I want to convert it to a BufferedImage as the new encode() takes BufferedImage instead of FileOutputStream (that was used earlier). FileOutputStream fos = null; fos = new FileOutputStream(actualImagePath,false); if (fos != null) {customBean.encode(<BufferredImageRequired> ; I cannot change the approach to maintain backward compatibility. Is there a way we can do this?
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12911
|
|
|
That's not possible. Can you explain more about the project you're working on? Do you understand exactly what the encode(...) method is supposed to do in the context of the project?
|
 |
 |
|
|
subject: BufferedImage from FileOutputStream
|
|
|