Пример #1
0
  private ReadProgress loadReadProgress(final ITweetFeed feed) {
    try {
      final BufferedReader is =
          new BufferedReader(new FileReader(Config.getStatProgressFilename()));
      final String line = is.readLine();

      final String[] split = line.split("\\s");

      return new ReadProgress(
          Long.valueOf(split[0]), Long.valueOf(split[1]), Integer.valueOf(split[2]));
    } catch (FileNotFoundException e) {
    } catch (IOException e) {
    }
    return null;
  }
Пример #2
0
  private void storeReadProgress(final ReadProgress progress) throws IOException {
    final String toWrite =
        String.format(
            "%d %d %d",
            progress.lastContinuouslyProcessedId,
            progress.lastProcessedId,
            progress.lastProcessedPage);

    final PrintWriter writer =
        new PrintWriter(new FileWriter(Config.getStatProgressFilename(), false));
    try {
      writer.append(toWrite);
      writer.flush();
    } finally {
      writer.close();
    }
  }