예제 #1
1
파일: Rag.java 프로젝트: pabloloyola/soot
  public void runImpl() throws Exception {
    // create the URL corresponding to the date

    URL u = new URL(ADDRESS_ + dateFormatter1_.format(date));
    Messages.debug(3, "Rag::runImpl - reading data from URL=%1", u);
    // fetch the page into the buffer
    buffer_ = new char[BUF_SIZE_];
    Reader r = new InputStreamReader(u.openStream());
    int size = 1;
    charsread_ = 0;
    while (charsread_ < BUF_SIZE_ && size > 0) {
      size = r.read(buffer_, 0, BUF_SIZE_ - charsread_);
      if (size != -1) charsread_ += size;
      // Messages.debug(3, "Rag::runImpl - read %1 chars", String.valueOf(size));
      if (!r.ready()) break;
    }
    r.close();
    // Messages.debug(3, "Rag::runImpl - buffer=\"%1\"XXXXXXX", new String(buffer_, 0, charsread_));
    // create the results
    createResults_();
  }
예제 #2
0
파일: Rag.java 프로젝트: pabloloyola/soot
 private void createResults_() {
   results = new LinkedList();
   String dateTime = dateFormatter2_.format(date);
   // Messages.debug(3, "Rag::createResults_ dateTime=%1", dateTime);
   String regExp = "HREF=\\/(rapp[\\/a-zA-Z0-9]*" + dateTime + "[a-zA-Z0-9_\\.]*)>";
   Messages.debug(3, "Rag::createResults_ regExp=%1", regExp);
   Regexp reg = Regexp.compile(regExp);
   // Messages.debug(3, "Rag::createResults_ compiled regexp");
   Result result;
   int pos = 0;
   while ((result = reg.searchForward(buffer_, pos, charsread_ - pos)) != null) {
     pos = result.getMatchEnd() + 1;
     // Messages.debug(3, "Rag:: gotResult:" + result.getMatch(1));
     results.add(RESULT_ADDRESS_ + result.getMatch(1));
   }
 }