Forums Register Login

How to convert an InputStream to an OutputStream?

+Pie Number of slices to send: Send
I get an InputStream using
InputStream is = this.getClass().getResourceAsStream( "myfile.txt" );
After processing it I want to write to the same file “myfile.txt”. How to do this? I only know this file is in the class file folder and I don’t know its absolute path.
Thanks.
+Pie Number of slices to send: Send
I'd try something like this:
+Pie Number of slices to send: Send
Thanks Jim!
It works.
URL url = this.getClass().getResource("test.xml");
+Pie Number of slices to send: Send
Drat. Obviously I meant getResource() rather than getResourceAsStream(). Anyway you seem to have worked that part out for yourself.
And inside of my fortune cookie was this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 10792 times.
Similar Threads
utf-8 character file -check
copy file from local host to remote host
who can help me?
How to create File object for servlet and so where to place the folder
case sensitiveness on samba share
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:05:30.