user2524908
user2524908

Reputation: 871

Java write to ResourceBundle

Is it possible to write back to a ResourceBundle? Currently I am using a ResourceBundle to store information, at runtime it is read using the following

while(ResourceBundle.getBundle("bundleName").getKeys().hasMoreElements()){

//output

}

Should I not be using a ResourceBundle if I wish to write to it?

Upvotes: 1

Views: 2693

Answers (1)

James Kingsbery
James Kingsbery

Reputation: 7486

It looks like by default this is not the case, but you can pass an instance of ResourceBundle.Control to ResourceBundle.getBundle to use a custom subclass of ResourceBundle that would expose a setKey method that lets you set the keys.

Upvotes: 1

Related Questions