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

Java NIO APIÏê½â

 
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blocking)IO²Ù×÷µÄAPI±»ÒýÈë¡£±¾ÎĶÔÆä½øÐÐÉîÈëµÄ½éÉÜ¡£

NIO APIÖ÷Òª¼¯ÖÐÔÚjava.nioºÍËüµÄsubpackagesÖУº

java.nio
¶¨ÒåÁËBuffer¼°ÆäÊý¾ÝÀàÐÍÏà¹ØµÄ×ÓÀà¡£ÆäÖб»java.nio.channelsÖеÄÀàÓÃÀ´½øÐÐIO²Ù×÷µÄByteBufferµÄ×÷Ó÷dz£ÖØÒª¡£

java.nio.channels
¶¨ÒåÁËһϵÁд¦ÀíIOµÄChannel½Ó¿ÚÒÔ¼°ÕâЩ½Ó¿ÚÔÚÎļþϵͳºÍÍøÂçͨѶÉϵÄʵÏÖ¡£Í¨¹ýSelectorÕâ¸öÀ࣬»¹ÌṩÁ˽øÐзÇ×èÈûIO²Ù×÷µÄ°ì·¨¡£Õâ¸ö°ü¿ÉÒÔ˵ÊÇNIO APIµÄºËÐÄ¡£

java.nio.channels.spi
¶¨ÒåÁË¿ÉÓÃÀ´ÊµÏÖchannelºÍselector APIµÄ³éÏóÀà¡£

java.nio.charset
       ¶¨ÒåÁË´¦Àí×Ö·û±àÂëºÍ½âÂëµÄÀà¡£

java.nio.charset.spi
       ¶¨ÒåÁË¿ÉÓÃÀ´ÊµÏÖcharset APIµÄ³éÏóÀà¡£

java.nio.channels.spiºÍjava.nio.charset.spiÕâÁ½¸ö°üÖ÷Òª±»ÓÃÀ´¶ÔÏÖÓÐNIO API½øÐÐÀ©Õ¹£¬ÔÚʵ¼ÊµÄʹÓÃÖУ¬ÎÒÃÇÒ»°ãÖ»ºÍÁíÍâµÄ3¸ö°ü´ò½»µÀ¡£ÏÂÃ潫¶ÔÕâ3¸ö°üÒ»Ò»½éÉÜ¡£

Package java.nio
Õâ¸ö°üÖ÷Òª¶¨ÒåÁËBuffer¼°Æä×ÓÀà¡£Buffer¶¨ÒåÁËÒ»¸öÏßÐÔ´æ·Åprimitive typeÊý¾ÝµÄÈÝÆ÷½Ó¿Ú¡£¶ÔÓÚ³ýbooleanÒÔÍâµÄÆäËûprimitive type£¬¶¼ÓÐÒ»¸öÏàÓ¦µÄBuffer×ÓÀ࣬ByteBufferÊÇÆäÖÐ×îÖØÒªµÄÒ»¸ö×ÓÀà¡£

ÏÂÃæÕâÕÅUMLÀàͼÃèÊöÁËjava.nioÖеÄÀàµÄ¹Øϵ£º
Buffer
¶¨ÒåÁËÒ»¸ö¿ÉÒÔÏßÐÔ´æ·Åprimitive typeÊý¾ÝµÄÈÝÆ÷½Ó¿Ú¡£BufferÖ÷Òª°üº¬ÁËÓëÀàÐÍ£¨byte, char…£©Î޹صŦÄÜ¡£ÖµµÃ×¢ÒâµÄÊÇBuffer¼°Æä×ÓÀ඼²»ÊÇḬ̈߳²È«µÄ¡£

ÿ¸öBuffer¶¼ÓÐÒÔϵÄÊôÐÔ£º

capacity
Õâ¸öBuffer×î¶àÄܷŶàÉÙÊý¾Ý¡£capacityÒ»°ãÔÚbuffer±»´´½¨µÄʱºòÖ¸¶¨¡£
limit
ÔÚBufferÉϽøÐеĶÁд²Ù×÷¶¼²»ÄÜÔ½¹ýÕâ¸öϱꡣµ±Ð´Êý¾Ýµ½bufferÖÐʱ£¬limitÒ»°ãºÍcapacityÏàµÈ£¬µ±¶ÁÊý¾Ýʱ£¬limit´ú±íbufferÖÐÓÐЧÊý¾ÝµÄ³¤¶È¡£
position
¶Á/д²Ù×÷µÄµ±Ç°Ï±ꡣµ±Ê¹ÓÃbufferµÄÏà¶ÔλÖýøÐжÁ/д²Ù×÷ʱ£¬¶Á/д»á´ÓÕâ¸öϱê½øÐУ¬²¢ÔÚ²Ù×÷Íê³Éºó£¬buffer»á¸üÐÂϱêµÄÖµ¡£
mark
Ò»¸öÁÙʱ´æ·ÅµÄλÖÃϱꡣµ÷ÓÃmark()»á½«markÉèΪµ±Ç°µÄpos


Ïà¹ØÎĵµ£º

javaÈëÃÅ

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

javaλÔËËã

Java ¶¨ÒåµÄλÔËË㣨bitwise operators £©Ö±½Ó¶ÔÕûÊýÀàÐ͵Äλ½øÐвÙ×÷£¬ÕâЩÕûÊýÀàÐÍ°üÀ¨long£¬int£¬short£¬char£¬and byte ¡£±í4-2 ÁгöÁËλÔËË㣺
±í4.2 λÔËËã·û¼°Æä½á¹û
ÔËËã·û                     &nb ......

UbuntuÏ´Java¿ª·¢»·¾³[ÒýÓÃ]

°²×°ÓëÉèÖÃJDK
Sun JDKµÄ°²×°»ù±¾ÉÏÓÐÁ½ÖÖ·½Ê½:
1. ͨ¹ýUbuntuÌṩµÄ°ü¹ÜÀí¹¤¾ß½øÐа²×°
UbuntuÔÚÆä°ü²Ö¿âÀﶼ°üÀ¨ÓÐJDKµÄ°²×°£¬Ö»Òªsources.listÉèÖÃÕýÈ·£¬Í¨
¹ýapt-get, aptitude, Synaptic Package
ManagerµÈ¶¼ÄÜ°²×°£¬¶øÇÒÏà¹ØµÄÉèÖÃÒ²ÈÝÒ׵öࣻÔÚUbuntuµÄÐÂ
·¢²¼°æ±¾Àﶼ´øÁËJDK5.0,ºÍJDK6.0µÄ°²×°Ö§³Ö,¶øÇÒ ......

JAVA»·¾³±äÁ¿µÄÅäÖÃ

   JAVAµÄ³ÌÐò¿ª·¢£¬µÚÒ»²½ÊÇÕë¶ÔJAVA´î½¨ÆäÓ¦Óÿª·¢Æ½Ì¨¡£¹ØÓÚJDKµÄÏÂÔØÓë°²×°Ôڴ˲»¹ý¶à½éÉÜ£¬ÍøÉÏÏà¹ØÁ´½Ó½Ï¶à¡£Æ½Ì¨µÄ´î½¨Ò»¸ö»ù´¡²½ÖèÇҹؼü²½Öè¾ÍÊÇ£ºjava»·¾³±äÁ¿µÄÅäÖá£ÍøÉϹØÓÚJAVAµÄ»·¾³±äÁ¿ÉèÖ÷½·¨ºÜ¶à£¬Æð³õ½Ó´¥JAVA¿Ï¶¨ÓÐÐí¶à²»Ã÷°×µÄµØ·½£¬ÎÒÃÇÐèÒª°Ñ²½Ö辡Á¿µÄ¼ò»¯£¬±¾È˾õµÃ±È½ÏÓÐЧµÄ·½·¨ÈçÏ ......

java»º´æ´¦Àí

java»º´æ¼¼ÊõÒ»£¨×ª£©
¿´Ò»Á£É³ÖеÄÊÀ½ç£¬ Ò»¶äÒ°»¨ÖеÄÌìÌᣠ°ÑÎÞÏÞÎÕÓÚÕÆÖУ¬ °ÑÓÀºãÎÕÓÚ˲¼ä¡£——ÍþÁ®• ²¼À³¿Ë
¿ªÊ¼ÌÖÂÛ»º´æ֮ǰ,ÈÃÎÒÃÇÏÈÀ´ÌÖÂÛÌÖÂÛÁíÍâÒ»¸öÎÊÌâ:ÀíÂÛºÍʵ¼ù.´Óahuaxuan½Ó´¥µÄ³ÌÐòÔ±À´¿´,ÓеijÌÐòԱƫʵ¼ù,ÓеijÌÐòԱƫÀíÂÛ,µ«ÊÇÕⶼÊDz»ºÃµÄÐÐΪ,ÀíÂÛºÍʵ¼ùͬÑùÖØÒª,ÎÒÃÇÔÚ×öºÜ¶àº ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ