Yes, you can control the download using Control . Here is an example run:
public class FolderControl extends Control { public ResourceBundle newBundle (String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException { String resourceName = "/" + locale.getCountry() + "/" + locale.getLanguage() + "/" baseName + ".properties"; ResourceBundle bundle = null; InputStream stream = null; if (reload) { URL url = loader.getResource(resourceName); if (url != null) { URLConnection connection = url.openConnection(); if (connection != null) { connection.setUseCaches(false); stream = connection.getInputStream(); } } } else { stream = loader.getResourceAsStream(resourceName); } if (stream != null) { try { bundle = new PropertyResourceBundle(new InputStreamReader(stream, "UTF-8")); } finally { stream.close(); } } return bundle; } }
(source code is copied from the default implementation only with a modified resourceName and a change in PropertyResourceBundle to read the stream as UTF-8 - there is no need for native2ascii)
which you use as follows
ResourceBundle bundle = ResourceBundle.getBundle("myresource", new FolderControl());
See also:
source share