@SuppressWarnings("unchecked")
  @Override
  public void reload() {
    synchronized (sync) {
      try {

        if (!mFile.getBaseFile().exists()) {
          XLog.w("getBaseFile not exists, skip load: " + name());
          return;
        }

        if (mFile.getBaseFile().isDirectory()) {
          XLog.w("getBaseFile isDirectory, clean up: " + name());
          FileUtils.deleteDirQuiet(mFile.getBaseFile());
          mFile.delete();
        }

        @Cleanup
        InputStream inputStream = mFile.openRead();
        Set<String> h = new HashSet(XmlUtils.readSetXml(inputStream));
        Set<T> t = new HashSet<>();
        CollectionUtils.consumeRemaining(h, s -> {
          T box = GsonUtils.GSON.fromJson(s, onCreateTypeToken().getType());
          if (box != null) {
            t.add(box);
          } else {
            XLog.w("JsonObjectSetRepo, T is null fromJson: " + s);
          }
        });
        mStorage.addAll(t);

      } catch (Throwable e) {
        XLog.w("Fail reload@IOException: " + mFile + "\n" + Log.getStackTraceString(e));
      }
    }
  }
Created by guohao4 on 2017/12/11. Email: Tornaco@163.com
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/persist/JsonObjectSetRepo.java