Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÐéÄâ»úÓÐÒ»¸ö×Ö·û´®³Ø,¶ÔÓÚ×Ö·û´®³ØµÄ·ÃÎÊ¿ÉÒÔʹÓÃ×Ö·û´®¶ÔÏóµÄintern()·½·¨,¿É¶¯Ì¬Ïò³ØÖÐÌí¼Ó¶ÔÏó,ËüµÄ¶¨ÒåÈçÏÂ:
public native String intern();
ÕâÊÇÒ»¸ö±¾µØ·½·¨,ÔÚµ÷ÓÃÕâ¸ö·½·¨Ê±,JAVAÐéÄâ»úÊ×Ïȼì²é×Ö·û´®³ØÖÐÊÇ·ñ´æÔÚÓë¸Ã×Ö·û´®¶ÔÏóÖµÏàµÈµÄ¶ÔÏó,Èç¹û´æÔھͷµ»Ø×Ö·û´®³ØÖеĶÔÏóµÄÒýÓÃ,·ñÔò¾Íд´½¨Ò»¸ö ......

Java ¿ª·¢ÎªÊ²Ã´ÐèÒª UML

Java ¿ª·¢ÎªÊ²Ã´ÐèÒª UML
 ¡¡¡¡ÖªµÀ UML Ôì³ÉÁËÔõÑùµÄ¾ÖÃæ´ó»ìÂÒÂð£¿ÖªµÀʲôÑùµÄ¹¦ÄÜÊÇ UML ÓµÓе« JAVA ²»¾ß±¸µÄÂð£¿ÖªµÀÎÒÃÇΪʲôÐèÒª³ý JAVA ÍâµÄÁíÒ»ÖÖµçÄÔÓïÑÔÂð£¿UML ²¢²»½ö½öÖ»ÊÇ JAVA »òÕßÆäËüʲôÓïÑÔµÄÌæ´úÆ·¡£UML ÊÇÃæÏò¶ÔÏóµÄ·ÖÎö¼°Éè¼ÆµÄ×¢ÊÍ¡£UML ÊǶÀÁ¢ÓÚÄÇЩ´«Í³Éè¼ÆÓïÑÔÖ®ÍâµÄÒ»ÖÖÓïÑÔ¡£ÒòΪ UML ......

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

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

Java Êý×é µÄ ¿½±´

 ¸´ÖÆÊý×éµÄ·½·¨£º
ÔÚJAVAÀïÃ棬¿ÉÒÔÓø´ÖÆÓï¾ä“A=B”¸ø»ù±¾ÀàÐ͵ÄÊý¾Ý´«µÝÖµ£¬µ«ÊÇÈç¹ûA,BÊÇÁ½¸öͬÀàÐ͵ÄÊý×飬¸´ÖƾÍÏ൱ÓÚ½«Ò»¸öÊý×é±äÁ¿µÄÒýÓô«µÝ¸øÁíÒ»¸öÊý×飻Èç¹ûÒ»¸öÊý×é·¢Éú¸Ä±ä£¬ÄÇôÒýÓÃͬһÊý×éµÄ±äÁ¿Ò²Òª·¢Éú¸Ä±ä¡£
ÒÔÏÂÊǹéÄɵÄJAVAÖи´ÖÆÊý×éÔªËØÖµµÄµÄ·½·¨£º£¨É±´£©
1¡£Ê¹ÓÃFORÑ­»· ......

java»º´æ´¦Àí£¨¶þ£©

2009-04-14 16:39
½üˮ¥̨ÏȵÃÔ£¬ÏòÑô»¨Ä¾Ò×Ϊ´º--------ËÕ÷ë
»º´æµÄ×÷ÓÃÔÚµÚÒ»ÂÛhttp://hi.baidu.com/%CB%BC%C3%F4%D3%EA/blog/item/908d0cdecbc8a71b495403cc.htmlÖÐÒÑÓв¿·Ö²ûÊö,ÏÂÃæahuaxuanºÍ´ó¼ÒÒ»ÆðÀ´Ñ§Ï°Ò»Ï»º´æµÃÁíÍâÒ»¸öÖØÒªµÄ¹æÔò,½üºÍ¿ì.
ÔÚÎÒÃÇ´ò¿ªä¯ÀÀÆ÷,¾ö¶¨ä¯ÀÀij¸öÍøҳ֮ǰ(Ö¸ÈËÑÛ¿´µ½ÆÁÄ»ÉϵÄÄÚÈ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ