Exemplo n.º 1
0
  public void serializeToFile(Context context) {
    if (this.bloomFilter == null) return;

    try {
      FileOutputStream fout = context.openFileOutput(DIRECTORY_FILE, 0);
      String numberFilter = Base64.encodeBytes(bloomFilter.getFilter());
      NumberFilterStorage storage =
          new NumberFilterStorage(numberFilter, bloomFilter.getHashCount());

      storage.serializeToStream(fout);
      fout.close();
    } catch (IOException ioe) {
      Log.w("NumberFilter", ioe);
    }
  }