Code example for RuleBasedCollator

0
  private Collator createFromRules(String fileName, ResourceLoader loader) {
    InputStream input = null;
    try { 
     input = loader.openResource(fileName);
     String rules = IOUtils.toString(input, "UTF-8");
     return new RuleBasedCollator(rules);
    } catch (IOException e) {
      // io error 
      throw new RuntimeException(e);
    } catch (ParseException e) {
      // invalid rules 
      throw new RuntimeException(e);
    } finally { 
      IOUtils.closeQuietly(input);
    } 
  } 
}