public void processUntil(ActionCallback callback) throws IOException {
    while (true) {
      final int command = reader.read();
      if (command == -1) {
        break;
      }

      processCommandAndNotifyFileBased(command);
      if (callback.isProcessed()) {
        break;
      }
    }
  }