Beispiel #1
0
  public void downLoadByList() {
    String url = null;
    String filename = null;
    // processbar.setValue(1);
    // 按列表顺序保存资源
    for (int i = 0; i < vDownLoad.size(); i++) {
      url = (String) vDownLoad.get(i);
      filename = (String) vFileList.get(i);
      try {
        GetLzTianya(url, filename);
        MP.changeProcess(((85 * (i + 1)) / vDownLoad.size()) + 10);
      } catch (IOException err) {
        if (DEBUG) {
          title = null;
          author = null;
          link = null;
          mark = 0;
          title_mark = 0;
          pages = 1;
          bug = 1;
        }
      }
    }

    if (DEBUG) {
      if (bug == 0 && !stop_mark) {
        title = null;
        author = null;
        link = null;
        mark = 0;
        title_mark = 0;
        pages = 1;
        bug = 0;
      } else {
        bug = 0;
      }
      if (downpdf) doc.close();
      page = null;
      mt.Done = true;
      XMLInfo.Done(mt);
      MP.changeProcess(100);
      vDownLoad = new Vector<String>();
      vFileList = new Vector<String>();
    }
  }
Beispiel #2
0
 public void StartDownload() {
   try {
     long tt = System.currentTimeMillis();
     addItem(page, "1.shtml");
     downLoadFirst();
     MP.changeProcess(5);
     String[] tmp_head = page.split("\\d{1,5}\\.shtml");
     for (int i = 2; i < (pages * 1) + 1; i += 1) {
       addItem(tmp_head[0] + String.valueOf(i) + ".shtml", String.valueOf(i) + ".shtml");
     }
     downLoadByList();
     long tt1 = System.currentTimeMillis();
     tt1 = tt1 - tt;
   } catch (Exception err) {
     // System.out.println(err.getMessage());
   }
 }