Java IO¿ò¼Ü
¿É´ÓIOµÄÀà²ã´Î£¬IO¿ò¼ÜµÄÉè¼ÆģʽÀ´ÂÛÊö¡£
×ÜÌåÀ´Ëµ£¬IO¿ÉÒÔ·ÖΪ×Ö½ÚÁ÷ºÍ×Ö·ûÁ÷£¬²»Í¬ÔÚÓÚ×Ö·ûÁ÷ÓÉ×Ö½ÚÁ÷°ü×°¶øÀ´£¬ÔÚIO¶ÁÈëÖ®ºó¾¹ýJVM´¦Àí£¬°Ñ×Ö½ÚÁ÷ת»»³É×Ö·ûÁ÷¡£¶ø×Ö·ûÁ÷µÄ×Ö·û²ÉÓÃÄÄÖÖ×Ö·û±àÂëʵÏÖÓÉJVMĬÈϱàÂë¾ö¶¨¡£
¶øÿ¸öÁ÷¶¼·ÖÊäÈëºÍÊä³ö£¬ËùÒÔ£¬×ÜÌåÀ´Ëµ£¬IOÓÐËĸö¶¥²ãÀࣺ
InputStream
OutputStream
Reader
Writer
¶ø×÷Ϊ»úÆ÷¼¶±ðÓÚ»úÆ÷Ö±½Ó½»»¥µÄÔòÊÇ×Ö½ÚÁ÷£º
InputStream
OutputStream
ÒÔIOµÄÖмäÀ࣬½øÐÐ×Ö½ÚÁ÷µ½×Ö·ûÁ÷µÄת»»¹ý¶É£¬Í¨³£¿É×÷Ϊ×Ö·ûÁ÷ÀàµÄ¹¹Ôì²ÎÊý£¬¿ÉÖ¸¶¨±àÂ룺
InputStreamReader
OutputStreamWriter
¶ø×Ö½ÚÁ÷ºÍ×Ö·ûÁ÷µÄ»º³åÈÝÆ÷À´¿´ÓÐbyteºÍcharÖ®·Ö£¬ËùÒÔÅÉÉú³ö£º
ByteArrayInputStream
ByteArrayOutputStream
CharArrayInputStream
CharArrayOutputStream
ÒÔÉÏÀàÖ»ÊDZíʾÁ÷µÄ±íʾÐÎʽ£¬¶øÔÚ´«ÊäÐÎʽÉÏ»¹±íÏÖΪÊÇ·ñÓлº³å¡£ËùÒÔ£¬¿ÉÒÔÅÉÉú³ö×ÓÀàΪ¿É»º³åÀࣺ
BufferInputStream
BufferOutputStream
BufferReader
BufferWriter
ÿһ¸ö¶¥²ãÀ඼ÓжÔĿ¼Îļþ£¨File£©µÄÖ§³Ö£º
FileInputStream
FileOutputStream
FileReader
FileWriter
ÔÚJavaÖУ¬Ò»¸öÇ¿´óµÄ¹¦ÄܾÍÊÇ¿ÉÒÔ¶Ô¶ÔÏó½øÐÐÐòÁл¯£¬×ª³É¶þ½øÖÆÎļþÊä³ö£¬Ò²¾ÍÊÇ×Ö½ÚÁ÷Êä³ö¶ø²»ÊÇ×Ö·ûÁ÷Êä³ö£¬ËùÒÔÓж¥²ãµÄInputStreamºÍOutputStreamÅÉÉúÀࣺ
ObjectInputStream
ObjectOutputStream
Á÷°üÀ¨Á˽ڵãÁ÷ºÍ¹ýÂËÁ÷£¬×¢ÒâµÄÊǹýÂËÁ÷£¬¿ÉÔÚ¶ÁдµÄͬʱ¶ÔÊý¾Ý½øÐвÙ×÷£¬²¢ÇÒʵÏÖÁËͬ²½²Ù×÷£¬¶¥²ã¹ýÂËÁ÷Àࣺ
FilterInputStream
FilterOutputStream
Æä×ÓÀàÔòÔÚÆä»ù´¡ÉÏ£¬¶Ô½ÚµãÁ÷½øÐзâ×°£¬³£¼û×ÓÀàÓУº
BufferInputStream BufferOutputStream
DataInputStream DataOutputStream
LineNumberInputStream PrintStream
¿É²Î¿¼×ÓÀàµÄ¹¹Ôì·½·¨¡£
ÒÔÉÏIO²Ù×÷¼¸ºõ¾ÍÊÇ°ÑÁ÷×°Ôص½ÄÚ´æÖУ¬¶ÔÆä½øÐвÙ×÷µÄʱºòÊÇ˳Ðò¶Áд£¬¶øÐèÒªËæ»ú¶Áдʱ£º
RandomAccessFile
´ÓÕû¸öÀà¿ò¼ÜµÄ½á¹¹ÊµÏֵĽӿÚÀ´¿´£¬¶¥²ãÀࣺ
InputStream implements Closable,
OutputStream implements Closable, Flushable
Reader implements Closable, Readable
Writer implements Closable, Flushable, Appendable
¸÷¸ö½Ó¿Ú·½·¨£º
Closable: close();
Flushabl
Ïà¹ØÎĵµ£º
¶àÏß³ÌÖ®¼äÐèҪе÷¹¤×÷¡£ÀýÈ磬ä¯ÀÀÆ÷µÄÒ»¸öÏÔʾͼƬµÄÏß³ÌdisplayThreadÏëÒªÖ´ÐÐÏÔʾͼƬµÄÈÎÎñ£¬±ØÐëµÈ´ýÏÂÔØÏß³ÌdownloadThread½«¸ÃͼƬÏÂÔØÍê±Ï¡£Èç¹ûͼƬ»¹Ã»ÓÐÏÂÔØÍ꣬displayThread¿ÉÒÔÔÝÍ££¬µ±downloadThreadÍê³ÉÁËÈÎÎñºó£¬ÔÙ֪ͨdisplayThread“ͼƬ׼±¸Íê±Ï£¬¿ÉÒÔÏÔʾÁË”£¬Õâʱ£¬displayThread¼ÌÐøÖ´ ......
FileInputStreamºÍFileOutputStream
FileInputStream £º
ÓÃÓÚ˳Ðò·ÃÎʱ¾µØÎļþ£¬ÓÃÓÚ¶ÁÈ¡ÖîÈçͼÏñÊý¾ÝÖ®ÀàµÄÔʼ×Ö½ÚÁ÷£¬´Ó³¬ÀàInputStreamÖм̳ÐÁËread,closeµÈ·½·¨£¬¶ÔÎļþ½øÐвÙ×÷£¬²»Ö§³Ö·½·¨ºÍ·½·¨£®ËüµÄÁ½¸ö³£ÓõĹ¹Ôì·½·¨ÊÇ£º¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
&nbs ......
ÔÚJavaÖУ¬²»Í¬µÄÀ඼ÓÐ×Ô¼ºµ¥¶ÀµÄCache»úÖÆ£¬ÊµÏֵķ½·¨Ò²¿ÉÄÜÓÐËù²»Í¬£¬ÎÄÕÂÁоÙÁËJavaÖг£¼ûµÄ¸÷ÀàCache»úÖƵÄʵÏÖ·½·¨£¬Í¬Ê±½øÐÐÁË×ۺϵıȽϡ£
OSCache
OSCacheÊǸöÒ»¸ö¹ã·º²ÉÓõĸßÐÔÄܵÄJava EE»º´æ¿ò¼Ü£¬OSCacheÄÜÓÃÓÚÈκÎJavaÓ¦ÓóÌÐòµÄÆÕͨµÄ»º´æ½â¾ö·½°¸¡£
OSCacheÓÐÒÔÏÂÌص㣺»º´æÈκζÔÏó£¬Äã¿ÉÒÔ²»ÊÜÏÞÖƵ ......
ÕâÀï±ÊÕß½éÉÜÒ»Öֺܳ£Óã¬Ò²±È½ÏרҵµÄȨÏÞ¿ØÖÆ˼·¡£ÕâÀïÓÃjavaÓïÑÔÃèÊö£¬Æäʵ¶¼²î²»¶àµÄ¡£Òª»»³ÉÆäËûµÄÓïÑÔÖ÷£¬×Ô¼º×ªÒ»Ï¾ͿÉÒÔÁË¡£ÎªÁË·½±ãÆð¼û£¬ÎÒÃÇÕâÀﶨÒåa^bΪ£ºaµÄb´Î·½¡£ÕâÀÎÒÃÇΪÿһ¸ö²Ù×÷É趨һ¸öΨһµÄÕûÊýÖµ£¬±ÈÈ磺
ɾ³ý£Á£££0
Ð޸ģÁ£££1
Ìí¼Ó£Á£££2
ɾ³ý£Â£££3
Ð޸ģ£££ ......
1£© ¾ßÌåÀ಻ÊÇÓÃÀ´¼Ì³ÐµÄ¡£Äܱ»¼Ì³ÐµÄÒ»¶¨ÊdzéÏóÀà¡£
Èç¹ûÔÚÒ»¸öÔʼµÄÉè¼ÆÀÓÐÁ½¸ö¾ßÌåÀ࣬ÀàAºÍÀàB,ÀàBÊÇÀàAµÄ×ÓÀ࣬ÄÇô×îºÃµÄÐ޸ķ½°¸ÊÇ£º
½¨Á¢Ò»¸ö³éÏ󣨻òÕß½Ó¿Ú£©C£¬È»ºóÈÃÀàAºÍÀàB³ÉΪÀàCµÄ×ÓÀà
2)³éÏóÀàÓ¦¾¡¿ÉÄܵÄÓµÓжàµÄ¹²Í¬´úÂë
Ò»¸ö¶ÔÏó´Ó³¬Àà¼Ì³Ð¶øÀ´µÄ´úÂ룬ÔÚ²»Ê¹ÓÃʱ²»»áÔì³É¶Ô×ÊÔ´µÄÀ ......