java Îļþ²Ù×÷
1.
BufferedReader in = new BufferedReader(new FileReader("Ô¶³ÌÎļþ"));
in.readLine() ;
l ʹÓà Java ²Ù×÷Îı¾ÎļþµÄ·½·¨Ïê½â
http://java.ccidnet.com/art/3737/20041108/523627_1.html
l FileReader ÊÇʲôÀࣿºÍ FileInputStream ÓÐʲô²»Í¬£¿£¿£¿
http://book.hackbase.com/ask2/ask107572.htm
1. FileÀà
1 £© File Àà½éÉÜ£¨¡¶ core java ¡· 638 Ò³£©
File Àà·â×°Á˶ÔÓû§»úÆ÷µÄÎļþϵͳ½øÐвÙ×÷µÄ¹¦ÄÜ¡£ÀýÈ磬¿ÉÒÔÓà File Àà»ñµÃÎļþÉÏ´ÎÐ޸ĵÄʱ¼äÒƶ¯£¬
»òÕ߶ÔÎļþ½øÐÐɾ³ý¡¢ÖØÃüÃû¡£»»¾ä»°Ëµ£¬Á÷Àà¹Ø×¢µÄÊÇÎļþÄÚÈÝ£¬¶ø File Àà¹Ø×¢µÄÊÇÎļþÔÚ´ÅÅÌÉϵĴ洢
¡£
File ÀàµÄÖ÷Òª·½·¨ÓУº getName(),getCanonicalFile(),lastModified(),isDerector(),isFile(),getPath()
µÈ£»
2 £© File ÀàÓë FileInputStream ÀàµÄÇø±ð£º
Á÷Àà¹Ø×¢µÄÊÇÎļþÄÚÈÝ£¬¶ø File Àà¹Ø×¢µÄÊÇÎļþÔÚ´ÅÅÌÉϵĴ洢¡£
File ²»ÊôÓÚÎļþÁ÷ , Ö»ÄÜ´ú±íÒ»¸öÎļþ»òÊÇĿ¼µÄ·¾¶Ãû¶øÒÑ¡£
Ìáʾ£º£¨¡¶ core java ¡· 639 Ò³£©
Èç¹û´¦ÀíÎļþ»òÕßĿ¼Ãû£¬¾ÍÓ¦¸ÃʹÓà File ¶ÔÏ󣬶ø²»ÊÇ×Ö·û´®¡£ÀýÈ磬 File ÀàµÄ equals ·½·¨ÖªµÀһЩ
Îļþϵͳ¶Ô´óСдÊÇÃô¸ÐµÄ£¬Ä¿Â¼Î²µÄ“ / ”×Ö·ûÎ޹ؽôÒª¡£
×Ô¼ºµÄÁì»á£º
FileInputStream Àà»òÕß FileReader ÀàµÄ¹¹Ô캯ÊýÓжà¸ö£¬ÆäÖеäÐ͵ÄÁ½¸ö·Ö±ðΪ£ºÒ»¸öʹÓà File ¶ÔÏóΪ
²ÎÊý£»¶øÁíÒ»¸öʹÓñíʾ·¾¶µÄ String ¶ÔÏó×÷Ϊ²ÎÊý£»×Ô¼ºÒÔÇ°Ò»Ö±¾õµÃÖ±½ÓÓÃÁË String Ö¸¶¨Â·¾¶¾Í¿ÉÒÔ
ÁË£¬Ò»Ö±²»Ã÷°×ΪʲôºÜ¶àÈ˶¼Ïȹ¹ÔìÒ»¸ö File ¶ÔÏó£¬ÏÖÔÚÖÕÓÚÃ÷°×ÁË£¬“Èç¹û´¦ÀíÎļþ»òÕßĿ¼Ãû£¬¾ÍÓ¦
¸ÃʹÓà File ¶ÔÏ󣬶ø²»ÊÇ×Ö·û´®¡£”£¡
2. FileInputStream Àà
1 £© FileInputStream Àà½éÉÜ£º
ÒÔ×Ö½ÚΪµ¥Î»£¨·Ç unicode £©µÄÁ÷´¦Àí¡£×Ö½ÚÐòÁм´£º¶þ½øÖÆÊý¾Ý¡£Óë±àÂëÎ޹أ¬²»´æÔÚÂÒÂëÎÊÌâ¡£
FileInputStream ÀàµÄÖ÷Òª·½·¨ÓУº
Read £¨£©£¬ read £¨ byte[] b £©£¬ read £¨ byte[],int off,int len £© ,available();
2 £© FileInputStream ÀàÓë FileReader ÀàµÄÇø±ð£º
Á½¸öÀàµÄ¹¹Ô캯ÊýµÄÐÎʽºÍ²ÎÊý¶¼ÊÇÏàͬµÄ£¬²ÎÊýΪ File ¶ÔÏó»òÕß±íʾ·¾¶µÄ String £¬ËüÃǵ½µ×ÓкÎÇø±ð
ÄØ£¿
l Readers and Writers work
Ïà¹ØÎĵµ£º
1.JavaÀïÃæʹÓÃ
static
·½·¨ÓÐʲôºÃ´¦£¿
´ð£ºÔÚÏîÄ¿ÖУ¬¶ÔÓÚƵ·±Ê¹Óõķ½·¨£¬Ê¹ÓÃstatic
ÐÞÊλáÌá¸ßЧÂÊÂð£¿
¾²Ì¬·½·¨µÄºÃ´¦¾ÍÊDz»ÓÃÉú³ÉÀàµÄʵÀý¾ÍÄÜÖ±½Óµ÷ÓúͶÔÏóÎÞ¹Ø
Äã²»ÓÃÉú³É¶ÔÏó¾ÍÄÜÓÃÕâ¸ö·½·¨ÁË£¬²»ÊÇÌá¸ßЧÂÊ£¿ÄãÉú³É¶ÔÏóµÃÕ¼ÓÃÄÚ´æ¿Õ¼ä°¡
ÖÁÓÚ¾²Ì¬ÊôÐÔÒ²ÄÜÌá¸ßЧÂÊ£¬ÄãÆÕͨµÄÊôÐÔÿ¸öÀà¶Ô ......
¾ÝÎĵµËù˵£¬ÀàÔöÇ¿Æ÷±ÈÓôúÀíµÄ·½Ê½ËÙ¶ÈÉÏÓÐÓÅÊÆ¡£
ÓÐÁ½ÖÖ·½Ê½£¬
µÚÒ»ÖÖÊÇÔÚÀà¼ÓÔØʱ¶¯Ì¬´¦Àí£¬Õâ¸ö¶ÔÏÖÓгÌÐò²»ÓÃÐ޸ġ£Ö»ÐèÒª¸ÄÏÂÔËÐеÄjava½Å±¾¼´¿É
¶ÔÓÚJava 1.5ÈçÏÂËùʾ
java -javaagent:lib/je-<version>.jar=enhance:packageNames ...
je-<version>.jar ¾ÍÊÇBerkeley DB JAVA¿âµÄÃû×Ö¡£ packageNa ......
°¥£¡×ªÑ۾͹ýÁËÒ»ÄêÁË£¬ÎÒºÃÏñʲô¶«Î÷¶¼Ñ§²»µ½Ñ½£¬ÕâÒªÈçºÎÊǺ𡣬ÕæµÄÐÄÀïºÜ¼±°¡£¡£¡£¡ÄĸöJAVA¸ßÊÖÖ¸µãÏÂÎÒÕâ¸öºó±²¿©£¬ÎÒ»áÍò·Ö¸ÐлÀ࣬ºÇºÇ£¬ºÜ¿ÉÄÜÊÇÎÒÀÏʦ²»Ðа¡£¡Ëý×Ô¼ºÉϿζ¼ÄÜ×ö³ö´íÎó³ÌÐò³öÀ´£¬»¹ôòÊǸöÈ˲ţ¬ÎÒ²»µÃ²»Åå·þËý°¡£¬ÎÒÃÇ°àÉÏÒ²ÓкöàÈËÔÚ˵ËýÊÇÔõôÔõôµÄ²î£¬°¥£¡ÎÒ¶¼²»Ï ......
ϵͳ×Ô¶¯Å׳öµÄÒì³£
ËùÓÐϵͳ¶¨ÒåµÄ±àÒëºÍÔËÐÐÒì³£¶¼¿ÉÒÔÓÉϵͳ×Ô¶¯Å׳ö£¬³ÆΪ±ê×¼Òì³££¬²¢ÇÒ Java Ç¿ÁÒµØÒªÇóÓ¦ÓóÌÐò½øÐÐÍêÕûµÄÒì³£´¦Àí£¬¸øÓû§ÓѺõÄÌáʾ£¬»òÕßÐÞÕýºóʹ³ÌÐò¼ÌÐøÖ´ÐС£
Óï¾äÅ׳öµÄÒì³£
Óû§³ÌÐò×Ô¶¨ÒåµÄÒì³£ºÍÓ¦ÓóÌÐòÌض¨µÄÒì³£,±ØÐë½èÖúÓÚ throws ºÍ throw Óï¾äÀ´¶¨ÒåÅ׳öÒì³£¡£
throwÊÇÓï¾äÅ׳ö ......