If so, all you can do is read that InputStream and save it to a temporary file
Main Topics
Browse All TopicsHi,
I have an InputStream. I need to turn it into a File instance. The classes I'm working with look like this:
InputStream is = SomeFactory.getResource("t
// read all bytes of the resource here into the InputStream
File file = new File(is);
DatabaseClass dc = new DatabaseClass(file);
so I have the raw InputStream, I need to read it, turn it into a File to give to my database class. Is this possible, if so how do I do it?
Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
HI!
Use FIleOutputStream (to write to the file ) and FileInputStream (to read the file) in this case.
Look at these examples.
http://www.java2s.com/Code
http://www.java2s.com/Code
and other File examples here
http://www.java2s.com/Code
Hope this helps.
Regards,
Tomas Helgi
>>>>>>Oh, what's the most efficient way to dump it to a file then?
Sorry! Misread that line ;-) See
http://technojeeves.com/jo
create a temporary file, and write the stream to that file
File tempFile1 = File.createTempFile(prefix
OutputStream out = new FileOutputStream(tempFile1
copy(is, out); // see link below
is.close();
out.close();
http://helpdesk.objects.co
http://helpdesk.objects.co
you can delete the temp file once done
http://helpdesk.objects.co
Business Accounts
Answer for Membership
by: CEHJPosted on 2009-10-31 at 08:44:23ID: 25710179
Is that all your DatabaseClass can handle as a parameter?