Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Convert inputstream to a file ?

807603Jan 28 2008 — edited Jan 31 2008
Hi,
I have to read a file present in the classpath and then get a File object

To read the file relatively I did the following:-
InputStream is = ClassName.class.getClassLoader().getResourceAsStream(pathOfTheClassInClasspath)

But now i need to convert it to a File object (to keep the method same as it was earlier), something like;
File f = ......

Is there any way to achieve what I am trying to ?

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Feb 28 2008
Added on Jan 28 2008
4 comments
4,259 views