• Post Reply Bookmark Topic Watch Topic
  • New Topic

Convert InputStream to FileOutputStream

 
Sam Seagal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I need to convert from an InputStream to a FileOutputStream.

I�m getting the InputStream witht his instruction:
InputStream outputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("MyFile");

�Any ideas?
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean convert? Do you mean you want to write the contents of the resource to a file? If so, reading the InputStream (byte per byte or byte[] per byte[]) and writing that to a FileOutputStream should work just fine.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy sebastian!

Welcome to javaranch!
We being a very friendly community, do not have much rules but there is a naming policy that we are very strict about!
Unfortunately, your display name does not follow the policy. Please take a moment to change the same.
 
Sam Seagal
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, byte per Byte works fine.

Thanks for the help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!