I am creating a program to process ResourceBundles and do stuff to the keys and values. However, I have come across the problem that there doesn't seem to be a constructor for the ResourceBundle class that would take a file name as input. The only way I can create ResourceBundles, it seems, is by referring to them with the fully qualified class name (e.g. com.example.MyBundle) as the base name.
Any ideas how I can get a working ResourceBundle object by passing in the file name (e.g. "/Volumes/users/me/myBundle.properties")??
That class doesn't seem to take a FileInputStream. It would work with PropertyResourceBundle, but that class is not meant to be used directly, according to the Java doc. I have tried it, but couldn't get the locale property of the instance after creation.
I have been playing around with this a bit more and I am still stuck. I can create a PropertyResourceBundle using the InputStream of my .properties file, but the getLocale() method on that PropertyResourceBundle still returns null. In a way it makes sense, because the constructor apparently isn't smart enough to take the locale ID from the file of the InputStream (e.g. "myFile_en_US").
So, what can I do to get a usable ResourceBundle object from my physical file?? (as opposed to having it in a Java package with a fully qualified name)