use of org.orcid.core.utils.Classpath.FileFilter in project ORCID-Source by ORCID.
the class PropertyFiles method loadProFiles.
@Before
public void loadProFiles() throws ZipException, IOException {
// ResourceBundle resources = ResourceBundle.
FileFilter fF = new FileFilter() {
public boolean accept(String fileName) {
return fileName.matches(".*messages[a-zA-Z\\_\\.]*\\.properties$");
}
};
String[] propfiles = Classpath.getClasspathFileNames(fF, true);
for (String propertiesFile : propfiles) {
if (!propertiesFile.contains("orcid"))
continue;
byte[] encoded = Files.readAllBytes(Paths.get(propertiesFile));
Charset utf = Charset.forName("UTF-8");
CharsetDecoder dec = utf.newDecoder();
dec.onUnmappableCharacter(CodingErrorAction.REPORT);
String propStr = dec.decode(ByteBuffer.wrap(encoded)).toString();
Properties prop = new Properties();
prop.load(new StringReader(propStr));
pList.add(prop);
}
}
Aggregations