Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cast FileOutputStream to File

807580Nov 2 2009 — edited Nov 3 2009
Hello, I'm using FileOutputStream to save in one document some information, but instead a FileOutputStream I want to create a File. Now I'm doing in two steps but I want to do that in one step. I don't know if it's possible do that I want:
FileOutputStream out = new FileOutputStream("C:/name.eml");
mensaje.writeTo(out);  
File emlFile = new File("C:/name.eml");
I want to do the same but doing something like this.
File emlFile = new File("C:/name.eml");
mensaje.writeTo(emlFile);
The problem is that the method writeTo only give me the chance to save like a FileOutputStream.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 1 2009
Added on Nov 2 2009
19 comments
4,912 views