예제 #1
0
  @Override
  public void load(ArrayStorePartition cache, File dataFile) throws IOException {
    String line;
    FileReader reader = new FileReader(dataFile);
    BufferedReader in = new BufferedReader(reader);

    int index = cache.getIdStart();
    int stopIndex = index + cache.getIdCount();

    while ((line = in.readLine()) != null && index < stopIndex) {
      try {
        cache.set(index, line.getBytes(), index);
      } catch (Exception e) {
        _log.error("index=" + index + ": " + e.getMessage());
        e.printStackTrace();
      }
      index++;
    }

    in.close();
    reader.close();
    cache.persist();
  }