Two Laptop Bag*
The moose likes Java in General and the fly likes Saving a Inputstream to file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Saving a Inputstream to file" Watch "Saving a Inputstream to file" New topic
Author

Saving a Inputstream to file

Alex Philippi
Greenhorn

Joined: Oct 05, 2007
Posts: 13
Hi,
I am saving a inputstream to a temp File (for accessing the stream more than once). But I think thats a kind of "ugly" code. Is there a better way to implement this?

Here the code:


Best Regards
Alex
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

You can gain some performance speed by using buffers for copying. So instead of

use

Varying the buffer size can improve speed even more.
Also try wrapping the reader in a BufferedReader and read from that.

Perform multiple tests to see which one is best for you.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Saving a Inputstream to file
 
Similar Threads
PDF with jsf
Untar a tar.gz file
File upload in struts
Drag and Drop to Desktop Issue
problem opening a new word file