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

JAVAÖ®IOÁ÷(³¬ÏêϸµÄJava.io°üµÄ½éÉÜ!)

JAVAÖ®IOÁ÷(³¬ÏêϸµÄ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 NIO APIÏê½â

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

½âÎöJavaÀàºÍ¶ÔÏóµÄ³õʼ»¯¹ý³Ì

ÀàµÄ³õʼ»¯ºÍ¶ÔÏó³õʼ»¯ÊÇ JVM ¹ÜÀíµÄÀàÐÍÉúÃüÖÜÆÚÖзdz£ÖØÒªµÄÁ½¸ö»·½Ú£¬Google ÁËÒ»±éÍøÂ磬ÓйØÀà×°ÔØ»úÖƵÄÎÄÕµ¹ÊDz»ÉÙ£¬È»¶øÀà³õʼ»¯ºÍ¶ÔÏó³õʼ»¯µÄÎÄÕ²¢²»¶à£¬ÌرðÊÇ´Ó×Ö½ÚÂëºÍ JVM ²ã´ÎÀ´·ÖÎöµÄÎÄÕ¸üÊÇÏÊÓÐËù¼û¡£
±¾ÎÄÖ÷Òª¶ÔÀàºÍ¶ÔÏó³õʼ»¯È«¹ý³Ì½øÐзÖÎö£¬Í¨¹ýÒ»¸öʵ¼ÊÎÊÌâÒýÈ룬½«Ô´´úÂëת»»³É JVM ×Ö½ÚÂëºó£¬ ......

Java½âÎöÍøÂçÊý¾ÝÁ÷µÄÈýÖÖÌØÊâ·½·¨

UTF8ת»»³ÉGB2312 µ±ÎÒÃÇÔÚ»ùÓÚHTTPЭÒéµÄJSP»òServletµÄÓ¦ÓÃÖлñÈ¡Êý¾Ý»ò·¢ËÍÇëÇóʱ£¬JVM»á°ÑÊäË͵ÄÊý¾Ý±àÂë³ÉUTF8¸ñʽ¡£Èç¹ûÎÒÃÇÖ±½Ó´ÓHTTPÁ÷ÖÐÌáÈ¡ÖÐÎÄÊý¾Ý£¬ÌáÈ¡µÄ½á¹ûΪ“????”£¨¿ÉÄܸü¶àÎʺţ©£¬Îª×ª»»³ÉÎÒÃÇÄܹ»Àí½âµÄÖÐÎÄ×Ö·û£¬ÎÒÃÇÐèÒª°ÑUTF8ת»»³ÉGB2312£¬½èÖúISO-8859-1±ê×¼±àÂëÄܹ»ÇáÒ×µÄʵÏÖ£¬ÏÂÃæ ......

java ²Ù×÷Cookie

java ²Ù×÷cookie
----------------------------------------------------------------------------------------------------------------------------------------------------
дÈëcookie
£¼%
String cookieName="Sender";
Cookie cookie=new Cookie(cookieName, "Test_Content");
cookie.setMaxAge(10);
respo ......

java ioc³õѧ

Ò»¡¢Ê²Ã´ÊÇIOC
IoC¾ÍÊÇInversion of Control£¬¿ØÖÆ·´×ª¡£ÔÚJava¿ª·¢ÖУ¬IoCÒâζ׎«ÄãÉè¼ÆºÃµÄÀཻ¸øϵͳȥ¿ØÖÆ£¬¶ø²»ÊÇÔÚÄãµÄÀàÄÚ²¿¿ØÖÆ¡£Õâ³ÆΪ¿ØÖÆ·´×ª¡£
ÏÂÃæÎÒÃÇÒÔ¼¸¸öÀý×ÓÀ´ËµÃ÷ʲôÊÇIoC
¼ÙÉèÎÒÃÇÒªÉè¼ÆÒ»¸öGirlºÍÒ»¸öBoyÀ࣬ÆäÖÐGirlÓÐkiss·½·¨£¬¼´GirlÏëÒªKissÒ»¸öBoy¡£ÄÇô£¬ÎÒÃǵÄÎÊÌâÊÇ£¬GirlÈçºÎÄܹ»ÈÏÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ