JAVA ÅÀÍøÒ³ÓÃ ÀýÈç:http://www.126.com
/*
Function name: myGetHttpFile2
Description: ÅÀÍøÒ³ÓÃ
Input: URL ÀýÈç:http://www.126.com
Output: ×Ö·û´®,ÍøÒ³µÄHTML
*/
public String myGetHttpFile2(String url){
String authentication=null;
ArrayList al=new ArrayList();
String PageURL = url;
PageURL = url ;
ArrayList urlCollection=new ArrayList();
Hashtable ht=new Hashtable();
//´úÀí£¬Èç¹ûÒª´©¹ý´úÀí½«ÏÂÃæ×¢ÊÍÈ¡Ïû
//ht=System.getProperties();
//authentication = "Basic " + new sun.misc.BASE64Encoder().encode("´úÀíµÄÓû§:´úÀíµÄÃÜÂë".getBytes());
//ht.put("proxySet", "true");
//ht.put("proxyHost", "172.16.20.2");
//ht.put("proxyPort", "80");
String urlSource=PageURL;
StringBuffer htmlBuffer=new StringBuffer();
String returnStr=null;
int codeStart=0;
int codeEnd=0;
int linkCount=0;
String getURL=null;
String realURL=null;
String urlText=null;
int from=0;
int lenURL=0;
int firstLink=0;
int endLink=0;
boolean isNewsLink=false;
try
{
URL su = new URL (urlSource);
URLConnection conn = su.openConnection();
//conn.setRequestProperty("Proxy-Authorization", authentication);
InputStream imageSource=new URL(urlSource).openStream();
int ch;
while((ch=imageSource.read())>-1)
{
htmlBuffer.append((char)ch);
}
imageSource.close();
returnStr= new String(htmlBuffer);
returnStr=new String(returnStr.getBytes("ISO8859_1"),"GBK");
}
catch(Exception e)
{
}
if(returnStr!=null){
return returnStr ;
}else{
return "empty" ;
}
}
Ïà¹ØÎĵµ£º
javaÉè¼ÆÄ£Ê½Ñ§Ï°1££Singleton Pattern
¡¡¡¡Ç°Ð©Ìì°ÚŪjava£¬²Î¿¼Ò»Ð©×ÊÁÏдÁ˸öÊý¾Ý¿âÁ¬½Ó³Ø£¬¶ÔÀïÃæÖ»²úÉúÒ»¸öʵÀýµÄÄÇÖÖ×ö·¨Éî±íÅå·þ£¬½ñÌìÖÐÎçÓÖÌýµ½±ðÈËÔÚ˵Éè¼ÆÄ£Ê½£¬Êܲ»ÁËÁË£¬¾ÍÉÏÍøDownÁ˵ã×ÊÁÏÀ´¡£
¡¡¡¡Ò»À´¾Í¿´µ½ÁËSingletonģʽ£¬Ò»¿´£¬Ñ½£¬²»¾ÍÊÇÄǸöÁ¬½Ó³ØÀïÓõķ½·¨Ã´?!àÞ£¬ÔÀ´Èç´Ë¡£
¡¡¡¡Singleton Ê ......
½«ÏÂÔØºóµÄÎļþ½â°ü£¬µÃµ½jxl.jar£¬·ÅÈëclasspath£¬°²×°¾ÍÍê³ÉÁË¡£
»ù±¾²Ù×÷
Ò»¡¢´´½¨Îļþ
ÄâÉú³ÉÒ»¸öÃûΪ“²âÊÔÊý¾Ý.xls”µÄExcelÎļþ£¬ÆäÖеÚÒ»¸ö¹¤×÷±í±»ÃüÃûΪ“µÚÒ»Ò³”£¬´óÖÂЧ¹ûÈçÏ£º
´úÂ루CreateXLS.java£©£º
//Éú³ÉExcelµÄÀà
import java.io.*;
import jxl.*;
import jxl.write. ......
1.ËãÊõÔËËã·û
JavaµÄËãÊõÔËËã·û·ÖΪһԪÔËËã·ûºÍ¶þÔªÔËËã·û¡£Ò»ÔªÔËËã·ûÖ»ÓÐÒ»¸ö²Ù×÷Êý£»¶þÔªÔËËã·ûÓÐÁ½¸ö²Ù×÷Êý£¬ÔËËã·ûλÓÚÁ½¸ö²Ù×÷ÊýÖ®¼ä¡£ËãÊõÔËËã·ûµÄ²Ù×÷Êý±ØÐëÊÇÊýÖµÀàÐÍ¡£
(1)Ò»ÔªÔËËã·û£º
Ò»ÔªÔËËã·ûÓУºÕý£¨+£©¡¢¸º£¨££©¡¢¼Ó1£¨++£©ºÍ¼õ1£¨£££ ......
Ò»¡¢Ê²Ã´ÊÇJavaÊÂÎñ
¡¡¡¡Í¨³£µÄ¹ÛÄîÈÏΪ£¬ÊÂÎñ½öÓëÊý¾Ý¿âÏà¹Ø¡£
¡¡¡¡ÊÂÎñ±ØÐë·þ´ÓISO/IECËùÖÆ¶¨µÄACIDÔÔò¡£ACIDÊÇÔ×ÓÐÔ£¨atomicity£©¡¢Ò»ÖÂÐÔ£¨consistency£©¡¢¸ôÀëÐÔ£¨isolation£©ºÍ³Ö¾ÃÐÔ£¨durability£©µÄËõд¡£ÊÂÎñµÄÔ×ÓÐÔ±íʾÊÂÎñÖ´Ðйý³ÌÖеÄÈκÎʧ°Ü¶¼½«µ¼ÖÂÊÂÎñËù×öµÄÈκÎÐÞ¸ÄʧЧ¡£Ò»ÖÂÐÔ±íʾµ±ÊÂÎñÖ´ÐÐʧ°Ü ......