Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java IO learning

javaѧϰ:³¹µ×Ã÷°×JavaµÄIOϵͳ
ÎÄÕÂÀ´Ô´£º»¥ÁªÍø
Ò»£® InputºÍOutput
1. stream´ú±íµÄÊÇÈκÎÓÐÄÜÁ¦²ú³öÊý¾ÝµÄÊý¾ÝÔ´£¬»òÊÇÈκÎÓÐÄÜÁ¦½ÓÊÕÊý¾ÝµÄ½ÓÊÕÔ´¡£ÔÚJavaµÄIOÖУ¬ËùÓеÄstream£¨°üÀ¨InputºÍOut stream£©¶¼°üÀ¨Á½ÖÖÀàÐÍ£º
1.1 ÒÔ×Ö½ÚΪµ¼ÏòµÄstream
ÒÔ×Ö½ÚΪµ¼ÏòµÄstream£¬±íʾÒÔ×Ö½ÚΪµ¥Î»´ÓstreamÖжÁÈ¡»òÍùstreamÖÐдÈëÐÅÏ¢¡£ÒÔ×Ö½ÚΪµ¼ÏòµÄstream°üÀ¨ÏÂÃ漸ÖÖÀàÐÍ£º
1) input¡¡stream£º
1) ByteArrayInputStream£º°ÑÄÚ´æÖеÄÒ»¸ö»º³åÇø×÷ΪInputStreamʹÓÃ
2) StringBufferInputStream£º°ÑÒ»¸öString¶ÔÏó×÷ΪInputStream
3) FileInputStream£º°ÑÒ»¸öÎļþ×÷ΪInputStream£¬ÊµÏÖ¶ÔÎļþµÄ¶ÁÈ¡²Ù×÷
4) PipedInputStream£ºÊµÏÖÁËpipeµÄ¸ÅÄÖ÷ÒªÔÚÏß³ÌÖÐʹÓÃ
5) SequenceInputStream£º°Ñ¶à¸öInputStreamºÏ²¢ÎªÒ»¸öInputStream
2) Out¡¡stream
1) ByteArrayOutputStream£º°ÑÐÅÏ¢´æÈëÄÚ´æÖеÄÒ»¸ö»º³åÇøÖÐ
2) FileOutputStream£º°ÑÐÅÏ¢´æÈëÎļþÖÐ
3) PipedOutputStream£ºÊµÏÖÁËpipeµÄ¸ÅÄÖ÷ÒªÔÚÏß³ÌÖÐʹÓÃ
4) SequenceOutputStream£º°Ñ¶à¸öOutStreamºÏ²¢ÎªÒ»¸öOutStream
1.2 ÒÔUnicode×Ö·ûΪµ¼ÏòµÄstream
ÒÔUnicode×Ö·ûΪµ¼ÏòµÄstream£¬±íʾÒÔUnicode×Ö·ûΪµ¥Î»´ÓstreamÖжÁÈ¡»òÍùstreamÖÐдÈëÐÅÏ¢¡£ÒÔUnicode×Ö·ûΪµ¼ÏòµÄstream°üÀ¨ÏÂÃ漸ÖÖÀàÐÍ£º
1) Input¡¡Stream
1) CharArrayReader£ºÓëByteArrayInputStream¶ÔÓ¦
2) StringReader£ºÓëStringBufferInputStream¶ÔÓ¦
3) FileReader£ºÓëFileInputStream¶ÔÓ¦
4) PipedReader£ºÓëPipedInputStream¶ÔÓ¦
2) Out¡¡Stream
1) CharArrayWrite£ºÓëByteArrayOutputStream¶ÔÓ¦
2) StringWrite£ºÎÞÓëÖ®¶ÔÓ¦µÄÒÔ×Ö½ÚΪµ¼ÏòµÄstream
3) FileWrite£ºÓëFileOutputStream¶ÔÓ¦
4) PipedWrite£ºÓëPipedOutputStream¶ÔÓ¦
ÒÔ×Ö·ûΪµ¼ÏòµÄstream»ù±¾É϶ÔÓÐÓëÖ®Ïà¶ÔÓ¦µÄÒÔ×Ö½ÚΪµ¼ÏòµÄstream¡£Á½¸ö¶ÔÓ¦ÀàʵÏֵŦÄÜÏàͬ£¬×ÖÊÇÔÚ²Ù×÷ʱµÄµ¼Ïò²»Í¬¡£ÈçCharArrayReader£ººÍByteArrayInputStreamµÄ×÷Óö¼ÊÇ°ÑÄÚ´æÖеÄÒ»¸ö»º³åÇø×÷ΪInputStreamʹÓã¬Ëù²»Í¬µÄÊÇÇ°Õßÿ´Î´ÓÄÚ´æÖжÁÈ¡Ò»¸ö×Ö½ÚµÄÐÅÏ¢£¬¶øºóÕßÿ´Î´ÓÄÚ´æÖжÁÈ¡Ò»¸ö×Ö·û¡£
1.3 Á½ÖÖ²»ÏÖµ¼ÏòµÄstreamÖ®¼äµÄת»»
InputStreamReaderºÍOutputStreamReader£º°ÑÒ»¸öÒÔ×Ö½ÚΪµ¼ÏòµÄstreamת»»³ÉÒ»¸öÒÔ×Ö·ûΪµ¼ÏòµÄstream¡£
2. streamÌí¼ÓÊôÐÔ
2.1 “ΪstreamÌí¼ÓÊôÐÔ”µÄ×÷ÓÃ
ÔËÓÃÉÏÃæ½éÉܵÄJavaÖвÙ×÷IOµÄAPI£¬ÎÒÃǾͿÉ


Ïà¹ØÎĵµ£º

javaÈëÃÅ

 Javaѧϰ´ÓÈëÃŵ½¾«Í¨ 
Ò»¡¢ JDK (Java Development Kit) 
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......

javaµ÷ÓÃnative2ascii.exe

 ±¾ÎÄÀ´×ÔCSDN²©¿Í£ºhttp://blog.csdn.net/xyk0830/archive/2007/11/06/1869638.aspx
ÃüÁîÐиñʽ£º
native2ascii.exe -[options] [inputfile [outputfile]]
ÆäÖУº
¡¡¡¡-[options]±íʾÃüÁ¹Ø£¬ÓÐÁ½¸öÑ¡Ïî¿É¹©Ñ¡Ôñ£º
¡¡¡¡¡¡¡¡-reverse£ºÓÃLatin-1»òUnicode±àÂë°ÑÎļþת»»³É±¾µØ±àÂë¸ñʽ
¡¡¡¡¡¡¡¡-encoding ......

¼¸ÖÖ¶ÁÈ¡ÊôÐÔÎļþµÄJAVAʵÏÖ·½Ê½

 
1.ʹÓÃjava.util.PropertiesÀàµÄload()·½·¨
InputStream in = lnew BufferedInputStream(new FileInputStream(name));
¡¡¡¡Properties p = new Properties();
¡¡¡¡p.load(in);
2.ʹÓÃjava.util.ResourceBundleÀàµÄgetBundle()·½·¨¡¡¡¡
ResourceBundle rb = ResourceBundle.getBundle(name, Locale.getDefault ......

javaÖйØÓÚÓÅÏȼ¶¶ÓÁеÄʵÏÖ




       
Õ⼸ÌìÒ»Ö±ÔÚ¸ã¹ØÓÚÓÅÏȼ¶¶ÓÁеÄʵÏÖ,ÒòΪҪ¿¼Âǵ½Ï̵߳ݲȫ,ËùÒÔPriorityQueue¾Í²»ÊÊÓÃÁË¡£Ò»¸ö·Ç³£¼òµ¥µÄʵÏÖ·½
·¨£¬ÄǾÍÊÇ°ÑÓÅÏȼ¶±È½ÏºÃµÄ²åÈëÒ»¸ö¶ÓÁУ¬ÓÅÏȼ¶µÍµÄ²åÈëÁíÒ»¸ö¶ÓÁУ¬È¡ÊýµÄʱºòÏÈÔÚÓÅÏȼ¶¸ßµÄ¶ÓÁÐÉÏÈ¡Êý¡£ÕâÓиöȱµã¾ÍÊÇÈç¹ûÓÅÏȼ¶±ðÔ½¶àµÄ»°£¬¶ÓÁ ......

javaÀ¬»ø»ØÊÕËã·¨Ò»¿ú







¼ÇµÃ²¿ÃÅÀÏ´óÔø¾­Ëµ¹ý£¬javaµÄÀ¬»ø»ØÊÕ»úÖƶÔÓÚjavaÌåϵ½á¹¹µÄѧϰ·Ç³£ÖØÒª¡£ÕâÀォÔĶÁµÄһЩÎÄÏ×ÕûÀí×ܽá³öÀ´£¬¼ÇÊöjavaµÄ¼¸ÖÖÀ¬»ø»ØÊÕËã·¨¡£
  À¬»ø»ØÊÕËã·¨ÓÐÁ½¸ö»ù±¾µÄÎÊÌ⣺1.±ØÐë¼ì²âµ½À¬»ø¶ÔÏó¡£2.±ØÐëÖØÐÂÉùÃ÷±»À¬»ø¶ÔÏóÕ¼ÓõĶѿռ䲢ÇÒÈöѿռä¿ÉÓá£
  ¿É´ïÐÔ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ