• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to locate outputStream using classLoader?

 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can locate a file that is in my class folder for INPUT using the following code:
ClassLoader loader = getClass().getClassLoader();
InputStream is = loader.getResourceAsStream( "AFile.txt" );
How to locate a file (in the same folder as the class) for OUTPUT using similar trick? getResourceAsStream() does not return an OutputStream!
Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!