Пример #1
0
  public boolean importFilterWords(String filterWordsPath) throws Exception {

    if (filterWordsPath == null) {
      System.out.println("warning: null " + filterWordsPath + "\n");
      filterWordsPath = this.filterWordsPath;
    }
    JSONLib jsonLib = new JSONLib();
    JSONArray filterArray = jsonLib.parseArrayFile(filterWordsPath);
    if (filterArray == null) {
      System.out.println("warning: parse " + filterWordsPath + " fail\n");
      filterSet = new HashSet<>(hashSetCapacity);
    } else {
      filterSet = new HashSet<>(filterArray);
    }
    int size = filterSet.size();
    System.out.println("imported filter words size: " + size + "\n");

    return true;
  }