java¶ÁдÎļþ_IO
ʹÓÃJava²Ù×÷Îı¾ÎļþµÄ·½·¨Ïê½â
ÕªÒª: ×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀà
×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀ࣬ÕâÁ½¸öÀ඼ÊdzéÏóÀ࣬WriterÖÐ write(char[] ch£¬int off£¬int length)£¬flush()ºÍclose()·½·¨Îª³éÏó·½·¨£¬ReaderÖÐread(char[] ch£¬int off£¬int length)ºÍclose()·½·¨ÊdzéÏó·½·¨¡£×ÓÀàÓ¦¸Ã·Ö±ðʵÏÖËûÃÇ¡£
¡¡¡¡µ±ÎÒÃǶÁдÎı¾ÎļþµÄʱºò£¬²ÉÓÃReaderÊǷdz£·½±ãµÄ£¬±ÈÈçFileReader£¬InputStreamReaderºÍBufferedReader¡£ÆäÖÐ×îÖØÒªµÄÀàÊÇInputStreamReader£¬ËüÊÇ×Ö½Úת»»Îª×Ö·ûµÄÇÅÁº¡£Äã¿ÉÒÔÔÚ¹¹ÔìÆ÷ÖØÖ¸¶¨±àÂëµÄ·½Ê½£¬Èç¹û²»Ö¸¶¨µÄ»°½«²ÉÓõײã²Ù×÷ϵͳµÄĬÈϱàÂ뷽ʽ£¬ÀýÈçGBK£¨ÔÛÃǵÄÖÐÎÄwindowsĬÈÏ£©µÈ¡£µ±Ê¹ÓÃFileReader¶ÁÈ¡ÎļþµÄʱºò¡£
¾ÍºÃÏñÒ»¸ù¹Ü×Ó²å½øÈ¥¿ªÊ¼¶ÁÊý¾Ý»òÕßдÊý¾Ý£¬ÕâÊÇ×Ö½ÚÁ÷£¨Input/Output StreamReader£©£¬¹Ü×ÓÍâÃæÔÙÌ׸ú¹Ü×Óת»»Îª×Ö·ûÁ÷£¬¶ÁÈ¡¸üΪ·½±ã¡£
FileReader fr = new FileReader("ming.txt");
int ch = 0;
while((ch = fr.read()) != -1 ){
System.out.print((char)ch);
}
ÆäÖÐread()·½·¨·µ»ØµÄÊǶÁÈ¡µÃϸö×Ö·û¡£µ±È»ÄãÒ²¿ÉÒÔʹÓÃread(char[] ch£¬int off£¬int length)ÕâºÍ´¦Àí¶þ½øÖÆÎļþµÄʱºòÀàËÆ£¬²»¶à˵ÁË¡£Èç¹ûʹÓÃInputStreamReaderÀ´¶ÁÈ¡ÎļþµÄʱºò
while((ch = isr.read())!=-1){
System.out.print((char)ch);
}
ÕâºÍFileReader²¢Ã»ÓÐʲôÇø±ð£¬ÊÂʵÉÏÔÚFileReaderÖеķ½·¨¶¼ÊÇ´ÓInputStreamReaderÖм̳йýÀ´µÄ¡£read()·½·¨ÊDZȽϷÑʱ¼äµÄ£¬Èç¹ûΪÁËÌá¸ßЧÂÊÎÒÃÇ¿ÉÒÔʹÓÃBufferedReader¶ÔReader½øÐаü×°£¬Í¬Ê±Ò²Îª±£»¤ÎÒÃǵÄÓ²ÅÌ£¬£¨Buffer »º³å£©ÕâÑù¿ÉÒÔÌá¸ß¶ÁÈ¡µÃËٶȣ¬ÎÒÃÇ¿ÉÒÔÒ»ÐÐÒ»ÐеĶÁÈ¡Îı¾£¬Ê¹ÓÃreadLine()·½·¨¡£
BufferedReader br = new BufferedReader(new InputStreamReader(new Fil
Ïà¹ØÎĵµ£º
http://blog.csdn.net/silentbalanceyh/archive/2009/09/24/4587371.aspx
¡¾ÎªÁËÈöÁÕß¿´ÆðÀ´±È½ÏÓнṹ£¬ÎÒ×Ô¼ºÄâÁËÒ»·ÝÍêÕûµÄÌá¸Ù£¬¶øÇÒΪÁËʹµÃ¶ÁÕßÒ»±ßѧϰÀíÂÛÒ»±ßѧϰÏà¹Ø´úÂëÄÚÈÝ£¬ÀïÃæ90%µÄ´úÂëÎÒ¶¼ÌṩÁËÍêÕûµÄ´úÂëDemo£¬Ö±½Ó¼üÈë¹ýºóÓ¦¸Ã¾Í¿ÉÒÔÔËÐУ¬¶øÇÒÀïÃæËùÓеÄÖصãÎÒ¶¼±ê×¢³öÀ´ÁË£¬Ö÷ÒªÊÇ·½±ã¶ÁÕß²»»áÒÅ©µ ......
ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr£¨£©£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache£¬SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£
Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110£º2046/ µÄURL·´Ïò´úÀíΪ http://www.javapeixun.com.cn / µÄURLÊ ......
Ḭ̈߳²È«
Ö»ÓÐÔÚµ¥Àý²¢·¢µÄÇé¿öϲŻá³öÏÖḬ̈߳²È«ÎÊÌ⣬ÒýÆðÎÊÌâµÄÖ÷ÒªÔÒò¾ÍÔÚÓÚ¶ÔÏóµÄ×ÊÔ´¹²Ïí(ÈçʵÀý±äÁ¿µÈ)£¬²»¹ý¾Ö²¿±äÁ¿ÊÇḬ̈߳²È«µÄ¡£Òò´ËÔÚ³ÌÐòÉè¼ÆµÄʱºò¾¡Á¿²»ÒªÓÃʵÀý±äÁ¿¡£²úÉúÕâÑùÔÒòÔÚÓÚjavaµÄÄÚ´æ·ÖÅä»úÖÆ£¬ÊµÀý±äÁ¿ÊÇ´æ·ÅÔÚ¶ÑÄÚ´æÖеÄËùÓÐÏ̹߳²Ïí£¬¶øÿ¸öÏß³ÌÒ²¶¼ÓÐ×Ô¼ºµÄÏß³ ......
ÏÈÀ´¿´¿´¿Í»§¶Î³ÌÐò±àдµÄÁ÷³Ì:
¡¡¡¡1¡¢ Ê×Ïȵ÷ÓÃSocketÀàµÄ¹¹Ô캯Êý£¬ÒÔ·þÎñÆ÷µÄÖ¸¶¨µÄIPµØÖ·»òÖ¸¶¨µÄÖ÷»úÃûºÍÖ¸¶¨µÄ¶Ë¿ÚºÅΪ²ÎÊý£¬´´½¨Ò»¸öSocketÁ÷£¬ÔÚ´´½¨SocketÁ÷µÄ¹ý³ÌÖаüº¬ÁËÏò·þÎñÆ÷ÇëÇó½¨Á¢Í¨Ñ¶Á¬½ÓµÄ¹ý³ÌʵÏÖ¡£
¡¡¡¡2¡¢ ½¨Á¢ÁË¿Í»§¶ËͨѶSocketºó¡£¾Í¿ÉÒÔʹÓÃSocketµÄ·½·¨getInputStream()ºÍgetOutputStream() ......
µ±JVM£¨JavaÐéÄâ»ú£©Æô¶¯Ê±£¬»áÐγÉÓÉÈý¸öÀà¼ÓÔØÆ÷×é³ÉµÄ³õʼÀà¼ÓÔØÆ÷²ã´Î½á¹¹£º
bootstrap classloader
|
extension classloader
&n ......