public class ResourceFinder extends Object
Given an absolute path to a folder containing a set of properties files (in resource bundle form) load the correct one based on the provided locale.
"path" will be tested to see if a folder on the external file system with this path exists. If it does, we will assume the resources are external. If "path" does not exist externally, we will look for it in the classpath.
Files with ".utf8" as the file extension are understood as UTF-8 encoded files. Do not use a BOM marker.
Files with".properties" extension are understood as traditional resource files containing unicode escapes. These escapes are not processed during the parse - you can convert the encoding using the encoding API.
| Modifier and Type | Field and Description |
|---|---|
(package private) Charset |
charset |
(package private) boolean |
isExternal |
(package private) LocalePathBuilder |
pathBuilder |
(package private) Properties |
props |
| Constructor and Description |
|---|
ResourceFinder(Properties props,
String path,
Locale locale,
String fileExt)
Constructor for classpath resource where the properties are injected into the provided props instance
|
ResourceFinder(String path,
Locale locale,
String fileExt)
Constructor for classpath resource
|
| Modifier and Type | Method and Description |
|---|---|
private void |
init(String path,
Locale locale,
String fileExt) |
Properties |
locate() |
private Properties |
locateExternal() |
final Properties props
LocalePathBuilder pathBuilder
boolean isExternal
Charset charset
public ResourceFinder(String path, Locale locale, String fileExt)
path - locale - fileExt - public ResourceFinder(Properties props, String path, Locale locale, String fileExt)
path - locale - fileExt - public Properties locate()
private Properties locateExternal()
Copyright © 2011–2016 David R. Smith. All rights reserved.