On 01-04-2009 at 01:09, AK wrote:
> On IRC I got the following suggestion for reading a properties file:
> 
> URL aURL = getClass().getClassLoader().getResource("myApp.properties")
> 
> The other suggestion I found online was:
> 
> InputStream inStream = this.getClass().getClassLoader().getResourceAsStream
> ("myApp.properties");
> 
> Is there a preference or advantage of one way over the other?

Assuming that you're reading a properties file (as opposed to a resource
bundle stored in properties files), I'd use the second option.

My reason: I can instantiate the Properties object, and call it's load(...)
method with the InputStream.


Oscar

-- 
   ,-_  Oscar Westra van holthe - Kind      http://www.xs4all.nl/~kindop/
  /() )
 (__ (  A: Because people normally read from top to bottom.
=/  ()  Q: Why is top-posting such a bad thing?

------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to