code: static String getFilenameFromUrl(String url) {
      String filename = md5(url) + ".down";
  
      int index = url.lastIndexOf("/");
      if (index > 0) {
        String tmpFilename = url.substring(index + 1);
        int qmarkIndex = tmpFilename.indexOf("?");
        if (qmarkIndex > 0) {
          tmpFilename = tmpFilename.substring(0, qmarkIndex - 1);
        }
  
        /* if filename contains '.', then the filename has file extension */
        if (tmpFilename.contains(".")) {
          filename = tmpFilename;
        }
      }
  
      return filename;
    }
docs: Get filename from url.
  
  @param url url
  @return filename or md5 if no available filename