| Code with Finding: |
class Hyphenator {
/**
* @param key
* @return a hyphenation tree
*/
public static HyphenationTree getResourceHyphenationTree(String key) {
try {
InputStream stream = BaseFont.getResourceStream(defaultHyphLocation + key + ".xml");
if (stream == null && key.length() > 2)
stream = BaseFont.getResourceStream(defaultHyphLocation + key.substring(0, 2) + ".xml");
if (stream == null)
return null;
HyphenationTree hTree = new HyphenationTree();
hTree.loadSimplePatterns(stream);
return hTree;
}
catch (Exception e) {
return null;
}
}
}
|