예제 #1
0
  public static void main(String[] args) {
    dumpSystemInfo();

    Set<?> keys = System.getProperties().keySet();

    @SuppressWarnings("unchecked")
    List<String> list = createArrayList((Set<String>) keys);

    Collections.sort(list);

    for (String key : list) {
      String value = System.getProperty(key);

      System.out.println(key + " = " + defaultIfNull(StringEscapeUtil.escapeJava(value), "[n/a]"));
    }
  }
  public static synchronized void loadDictionary() throws MorphException {
    try {
      List<String> strList =
          FileUtil.readLines("org/apache/lucene/analysis/kr/dic/mapHanja.dic", "UTF-8");
      mapHanja = new HashMap();

      for (int i = 0; i < strList.size(); i++) {

        if (strList.get(i).length() < 1 || strList.get(i).indexOf(",") == -1) continue;

        String[] hanInfos = StringUtil.split(strList.get(i), ",");

        if (hanInfos.length != 2) continue;

        String hanja = StringEscapeUtil.unescapeJava(hanInfos[0]);

        mapHanja.put(hanja, hanInfos[1].toCharArray());
      }
    } catch (IOException e) {
      throw new MorphException(e);
    }
  }
예제 #3
0
 /**
  * 输出到<code>StringBuilder</code>。
  *
  * @param buffer <code>StringBuilder</code>对象
  * @param caption 标题
  * @param value 值
  */
 private static void append(StringBuilder buffer, String caption, String value) {
   buffer
       .append(caption)
       .append(defaultIfNull(StringEscapeUtil.escapeJava(value), "[n/a]"))
       .append("\n");
 }