• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Saving a Inputstream to file

 
Alex Philippi
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20611
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic