@Override
        public void visit(Page page) {
        	
	            if(cntDownload % 100 == 0) {
	           	 timeWriter.println(cntDownload + ": " + StringUtil.getTimeStr());
	           	 timeWriter.flush();
	           }
	            cntDownload++;
        	
                int docid = page.getWebURL().getDocid();
                String url = page.getWebURL().getURL();
                String domain = page.getWebURL().getDomain();
                String path = page.getWebURL().getPath();
                String subDomain = page.getWebURL().getSubDomain();
                String parentUrl = page.getWebURL().getParentUrl();

                PageInfo pi = new PageInfo();
                
                System.out.println("Docid: " + docid);
                System.out.println("URL: " + url);
                String contentEncoding = page.getContentEncoding();
                String contentType = page.getContentType();
                String charset = page.getContentCharset();
                byte[] cd = page.getContentData();
                
                System.out.println("charset: " + charset);
                
                String fileName = StringUtil.getHTMLFileName();
                IO.writeBytesToFile(cd, DOWNLOAD_PATH + "html\\"+ fileName + ".html");
                
                List<WebURL> links;
                if (page.getParseData() instanceof HtmlParseData) {
                        HtmlParseData htmlParseData = (HtmlParseData) page.getParseData();
                        String text = htmlParseData.getText();
                        String html = htmlParseData.getHtml();
                        links = htmlParseData.getOutgoingUrls();
                        String title = htmlParseData.getTitle();
                   
                        String newText = null;
                        if(!charset.equalsIgnoreCase("utf-8") && !charset.equalsIgnoreCase("utf8")) {
                        	try{
                        		newText = new String(text.getBytes(charset), "UTF-8");
                        	}
                        	catch(Exception e) {
                        		e.printStackTrace();
                        	}
                        	
                        }
                        
                        System.out.println("Html length: " + html.length());
                        System.out.println("Number of outgoing links: " + links.size());
                        
                        pi.setDocID(docid);
                        pi.setUrl(url);
                        pi.setDomain(domain);
                        pi.setPath(path);
                        pi.setSubDomain(subDomain);
                        pi.setParentUrl(parentUrl);
                        pi.setContentType(contentType);
                        pi.setContentEncoding(contentEncoding);
                        pi.setCharset(charset);
                        pi.setSavedName(fileName);
                        pi.setPlain(text);
                        pi.setTitle(title);
                        
                        PageDAO.addPage(pi);
                        PageDAO.addLinks(docid, url, links);
                        

           
                                 					
            			File file = new File(DOWNLOAD_PATH + "text", fileName + ".txt");           //璁惧畾杈撳嚭鐨勬枃浠跺悕         			          			 
            			//outputStream.write(content);            			
            			BufferedWriter bfWriter = null;
            			try {
            				OutputStreamWriter outputStream = new OutputStreamWriter(new FileOutputStream(file),charset); 
            				//file.createNewFile();
            				bfWriter = new BufferedWriter(outputStream);
                			bfWriter.append(text);
                			bfWriter.flush();	

            			} catch (Exception e3) {
            				e3.printStackTrace();
            			}
  
                }

                System.out.println("=============\n");
        }