Search code examples
javaswingfile-iopropertiespersistence

Java OutputStream equivalent to getClass().getClassLoader().getResourceAsStream()


I am attempting to store the change made to my application's properties. The .properties file is located in resources package, which is different from the package that contains my UI and model.

I opened the package using:

this.getClass().getClassLoader().getResourceAsStream("resources/settings.properties")

Is there a functional equivalent of this that permits me to persist changes to the Properties Class in the same .Properties file?


Solution

  • It sounds like you want to store user preferences. Consider using the Java Preferences API for that.