class ActionFile {

  public DownloadRequest[] load() throws IOException {
    if (!exists()) {
      return new DownloadRequest[0];
    }
    InputStream inputStream = null;
    try {
      inputStream = atomicFile.openRead();
      DataInputStream dataInputStream = new DataInputStream(inputStream);
      int version = dataInputStream.readInt();
      if (version > VERSION) {
        throw new IOException("Unsupported action file version: " + version);
      }
      int actionCount = dataInputStream.readInt();
      ArrayList<DownloadRequest> actions = new ArrayList<>();
      for (int i = 0; i < actionCount; i++) {
        try {
          actions.add(readDownloadRequest(dataInputStream));
        } catch (UnsupportedRequestException e) {
          // remove DownloadRequest is not supported. Ignore and continue loading rest.
        }
      }
      return actions.toArray(new DownloadRequest[0]);
    } finally {
      Util.closeQuietly(inputStream);
    }
  }

  public  ActionFile(File actionFile);

}