{"id":5300,"date":"2021-12-12T10:45:31","date_gmt":"2021-12-12T02:45:31","guid":{"rendered":"https:\/\/www.xttblog.com\/?p=5300"},"modified":"2021-12-12T10:45:31","modified_gmt":"2021-12-12T02:45:31","slug":"java%e5%bf%85%e4%bc%9a%e7%9a%84io%e5%ad%97%e8%8a%82%e6%b5%81%e3%80%81%e5%ad%97%e7%ac%a6%e6%b5%81%e3%80%81%e7%bc%93%e5%86%b2%e6%b5%81%e7%9f%a5%e8%af%86%e6%80%bb%e7%bb%93%ef%bc%81","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=5300","title":{"rendered":"Java\u5fc5\u4f1a\u7684IO\u5b57\u8282\u6d41\u3001\u5b57\u7b26\u6d41\u3001\u7f13\u51b2\u6d41\u77e5\u8bc6\u603b\u7ed3\uff01"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u524d\u8a00<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u6709\u4eba\u66fe\u95ee fastjson \u7684\u4f5c\u8005\uff08\u963f\u91cc\u6280\u672f\u4e13\u5bb6\u9ad8\u94c1\uff09\uff1a\u201c<code>\u4f60\u5f00\u53d1fastjson\uff0c\u6ca1\u5f97\u5230\u4ec0\u4e48\u597d\u5904\uff0c\u53cd\u800c\u6328\u4e86\u9a82\u80cc\u4e86\u9505\uff0c\u8fd9\u79cd\u4e8b\u60c5\u4f60\u4e3a\u4ec0\u4e48\u8981\u505a\u5462\uff1f<\/code>\u201d<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>\u275d<\/strong><\/p><p>\u9ad8\u94c1\u7b54\u9053\uff1a\u201c<code>\u56e0\u4e3a\u70ed\u7231\u672c\u8eab\uff0c\u5c31\u662f\u5956\u52b1\u554a\uff01<\/code>\u201d\u275e<\/p><\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u56de\u7b54\u987f\u65f6\u89e6\u52a8\u4e86\u6211\u3002\u60f3\u60f3\u81ea\u5df1\uff0c\u53c8\u4f55\u5c1d\u4e0d\u662f\u5982\u6b64\u3002\u5199\u4f5c\u662f\u4e2a\u75db\u82e6\u7684\u8fc7\u7a0b\uff0c\u7528\u5fc3\u5199\u4f5c\u5c31\u66f4\u52a0\u714e\u71ac\uff0c\u9700\u5b57\u5b57\u659f\u914c\uff0c\u53cd\u590d\u5220\u6539\u624d\u6709\u6240\u6210\u3002\u7136\u800c\uff0c\u5f53\u4e00\u7bc7\u7bc7\u7cbe\u826f\u6587\u7ae0\u51fa\u81ea\u5df1\u624b\u800c\u5448\u73b0\u773c\u524d\u65f6\uff0c\u90a3\u4e9b\u75db\u82e6\u714e\u71ac\u5c31\u90fd\u90a3\u4e48\u503c\u5f97\u3002\u5982\u679c\u8fd9\u4e9b\u535a\u6587\u80fd\u6709\u5e78\u5f97\u5927\u5bb6\u9605\u8bfb\u548c\u8ba4\u53ef\uff0c\u5c31\u66f4\u52a0\u662f\u83ab\u5927\u7684\u9f13\u821e\u4e86\u3002<code>\u6280\u672f\u4eba\u7684\u5feb\u4e50\u5c31\u662f\u53ef\u4ee5\u8fd9\u4e48\u7eaf\u7cb9\u548c\u7b80\u5355<\/code>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6b63\u6587<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">IO \u6d41\u662f Java \u4e2d\u7684\u4e00\u4e2a\u91cd\u8981\u6784\u6210\u90e8\u5206\uff0c\u4e5f\u662f\u6211\u4eec\u7ecf\u5e38\u6253\u4ea4\u9053\u7684\u3002\u8fd9\u7bc7\u5173\u4e8e Java IO \u7684\u535a\u6587\u5e72\u8d27\u6ee1\u6ee1\uff0c\u582a\u79f0\u5168\u7f51\u524d\u4e09\uff08\u8bf7\u8f7b\u55b7\uff01\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u9762\u51e0\u4e2a\u95ee\u9898\uff08\u95ee\u9898\u8fd8\u4f1a\u7ee7\u7eed\u8865\u5145\uff09\uff0c\u5982\u679c\u4f60\u80fd\u5bf9\u7b54\u5982\u6d41\uff0c\u90a3\u4e48\u606d\u559c\u4f60\uff0cIO \u77e5\u8bc6\u638c\u63e1\u5f97\u5f88\u597d\uff0c\u53ef\u4ee5\u7acb\u5373\u5173\u95ed\u6587\u7ae0\u3002\u53cd\u4e4b\uff0c\u4f60\u53ef\u4ee5\u5728\u540e\u9762\u5f97\u6587\u7ae0\u4e2d\u5bfb\u627e\u7b54\u6848\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Java IO\u6d41\u6709\u4ec0\u4e48\u7279\u70b9\uff1f<\/li><li>Java IO\u6d41\u5206\u4e3a\u51e0\u79cd\u7c7b\u578b\uff1f<\/li><li>\u5b57\u8282\u6d41\u548c\u5b57\u7b26\u6d41\u7684\u5173\u7cfb\u4e0e\u533a\u522b\uff1f<\/li><li>\u5b57\u7b26\u6d41\u662f\u5426\u4f7f\u7528\u4e86\u7f13\u51b2\uff1f<\/li><li>\u7f13\u51b2\u6d41\u7684\u6548\u7387\u4e00\u5b9a\u9ad8\u5417\uff1f\u4e3a\u4ec0\u4e48\uff1f<\/li><li>\u7f13\u51b2\u6d41\u4f53\u73b0\u4e86Java\u4e2d\u7684\u54ea\u79cd\u8bbe\u8ba1\u6a21\u5f0f\u601d\u60f3\uff1f<\/li><li>\u4e3a\u4ec0\u4e48\u8981\u5b9e\u73b0\u5e8f\u5217\u5316?\u5982\u4f55\u5b9e\u73b0\u5e8f\u5217\u5316?<\/li><li>\u5e8f\u5217\u5316\u6570\u636e\u540e\uff0c\u518d\u6b21\u4fee\u6539\u7c7b\u6587\u4ef6\uff0c\u8bfb\u53d6\u6570\u636e\u4f1a\u51fa\u95ee\u9898\uff0c\u5982\u4f55\u89e3\u51b3\u5462?<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u521d\u8bc6 Java IO<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">IO\uff0c\u5373<code>in<\/code>\u548c<code>out<\/code>\uff0c\u4e5f\u5c31\u662f\u8f93\u5165\u548c\u8f93\u51fa\uff0c\u6307\u5e94\u7528\u7a0b\u5e8f\u548c\u5916\u90e8\u8bbe\u5907\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u9012\uff0c\u5e38\u89c1\u7684\u5916\u90e8\u8bbe\u5907\u5305\u62ec\u6587\u4ef6\u3001\u7ba1\u9053\u3001\u7f51\u7edc\u8fde\u63a5\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Java \u4e2d\u662f\u901a\u8fc7\u6d41\u5904\u7406 IO \u7684\uff0c<strong>\u300c\u90a3\u4e48\u4ec0\u4e48\u662f\u6d41\u300d<\/strong>\uff1f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6d41\uff08<code>Stream<\/code>\uff09\uff0c\u662f\u4e00\u4e2a\u62bd\u8c61\u7684\u6982\u5ff5\uff0c\u662f\u6307\u4e00\u8fde\u4e32\u7684\u6570\u636e\uff08\u5b57\u7b26\u6216\u5b57\u8282\uff09\uff0c\u662f\u4ee5\u5148\u8fdb\u5148\u51fa\u7684\u65b9\u5f0f\u53d1\u9001\u4fe1\u606f\u7684\u901a\u9053\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f53\u7a0b\u5e8f\u9700\u8981\u8bfb\u53d6\u6570\u636e\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u5f00\u542f\u4e00\u4e2a\u901a\u5411\u6570\u636e\u6e90\u7684\u6d41\uff0c\u8fd9\u4e2a\u6570\u636e\u6e90\u53ef\u4ee5\u662f\u6587\u4ef6\uff0c\u5185\u5b58\uff0c\u6216\u662f\u7f51\u7edc\u8fde\u63a5\u3002\u7c7b\u4f3c\u7684\uff0c\u5f53\u7a0b\u5e8f\u9700\u8981\u5199\u5165\u6570\u636e\u7684\u65f6\u5019\uff0c\u5c31\u4f1a\u5f00\u542f\u4e00\u4e2a\u901a\u5411\u76ee\u7684\u5730\u7684\u6d41\u3002\u8fd9\u65f6\u5019\u4f60\u5c31\u53ef\u4ee5\u60f3\u8c61\u6570\u636e\u597d\u50cf\u5728\u8fd9\u5176\u4e2d\u201c\u6d41\u201d\u52a8\u4e00\u6837\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u822c\u6765\u8bf4\u5173\u4e8e\u6d41\u7684\u7279\u6027\u6709\u4e0b\u9762\u51e0\u70b9\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u5148\u8fdb\u5148\u51fa\uff1a\u6700\u5148\u5199\u5165\u8f93\u51fa\u6d41\u7684\u6570\u636e\u6700\u5148\u88ab\u8f93\u5165\u6d41\u8bfb\u53d6\u5230\u3002<\/li><li>\u987a\u5e8f\u5b58\u53d6\uff1a\u53ef\u4ee5\u4e00\u4e2a\u63a5\u4e00\u4e2a\u5730\u5f80\u6d41\u4e2d\u5199\u5165\u4e00\u4e32\u5b57\u8282\uff0c\u8bfb\u51fa\u65f6\u4e5f\u5c06\u6309\u5199\u5165\u987a\u5e8f\u8bfb\u53d6\u4e00\u4e32\u5b57\u8282\uff0c\u4e0d\u80fd\u968f\u673a\u8bbf\u95ee\u4e2d\u95f4\u7684\u6570\u636e\u3002\uff08<code>RandomAccessFile<\/code>\u9664\u5916\uff09<\/li><li>\u53ea\u8bfb\u6216\u53ea\u5199\uff1a\u6bcf\u4e2a\u6d41\u53ea\u80fd\u662f\u8f93\u5165\u6d41\u6216\u8f93\u51fa\u6d41\u7684\u4e00\u79cd\uff0c\u4e0d\u80fd\u540c\u65f6\u5177\u5907\u4e24\u4e2a\u529f\u80fd\uff0c\u8f93\u5165\u6d41\u53ea\u80fd\u8fdb\u884c\u8bfb\u64cd\u4f5c\uff0c\u5bf9\u8f93\u51fa\u6d41\u53ea\u80fd\u8fdb\u884c\u5199\u64cd\u4f5c\u3002\u5728\u4e00\u4e2a\u6570\u636e\u4f20\u8f93\u901a\u9053\u4e2d\uff0c\u5982\u679c\u65e2\u8981\u5199\u5165\u6570\u636e\uff0c\u53c8\u8981\u8bfb\u53d6\u6570\u636e\uff0c\u5219\u8981\u5206\u522b\u63d0\u4f9b\u4e24\u4e2a\u6d41\u3002<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">IO \u6d41\u5206\u7c7b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">IO \u6d41\u4e3b\u8981\u7684\u5206\u7c7b\u65b9\u5f0f\u6709\u4ee5\u4e0b3\u79cd\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u6309\u6570\u636e\u6d41\u7684\u65b9\u5411\uff1a\u8f93\u5165\u6d41\u3001\u8f93\u51fa\u6d41<\/li><li>\u6309\u5904\u7406\u6570\u636e\u5355\u4f4d\uff1a\u5b57\u8282\u6d41\u3001\u5b57\u7b26\u6d41<\/li><li>\u6309\u529f\u80fd\uff1a\u8282\u70b9\u6d41\u3001\u5904\u7406\u6d41<\/li><\/ol>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io0.png\" alt=\"Java IO\" \/><figcaption>Java IO<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c1\u3001\u8f93\u5165\u6d41\u4e0e\u8f93\u51fa\u6d41\u300d<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u8f93\u5165\u4e0e\u8f93\u51fa\u662f\u76f8\u5bf9\u4e8e\u5e94\u7528\u7a0b\u5e8f\u800c\u8a00\u7684\uff0c\u6bd4\u5982\u6587\u4ef6\u8bfb\u5199\uff0c\u8bfb\u53d6\u6587\u4ef6\u662f\u8f93\u5165\u6d41\uff0c\u5199\u6587\u4ef6\u662f\u8f93\u51fa\u6d41\uff0c\u8fd9\u70b9\u5f88\u5bb9\u6613\u641e\u53cd\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io1.png\" alt=\"\u8f93\u5165\u6d41\u4e0e\u8f93\u51fa\u6d41\" \/><figcaption>\u8f93\u5165\u6d41\u4e0e\u8f93\u51fa\u6d41<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c2\u3001\u5b57\u8282\u6d41\u4e0e\u5b57\u7b26\u6d41\u300d<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u8282\u6d41\u548c\u5b57\u7b26\u6d41\u7684\u7528\u6cd5\u51e0\u4e4e\u5b8c\u6210\u5168\u4e00\u6837\uff0c\u533a\u522b\u5728\u4e8e\u5b57\u8282\u6d41\u548c\u5b57\u7b26\u6d41\u6240\u64cd\u4f5c\u7684\u6570\u636e\u5355\u5143\u4e0d\u540c\uff0c\u5b57\u8282\u6d41\u64cd\u4f5c\u7684\u5355\u5143\u662f\u6570\u636e\u5355\u5143\u662f8\u4f4d\u7684\u5b57\u8282\uff0c\u5b57\u7b26\u6d41\u64cd\u4f5c\u7684\u662f\u6570\u636e\u5355\u5143\u4e3a16\u4f4d\u7684\u5b57\u7b26\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c\u4e3a\u4ec0\u4e48\u8981\u6709\u5b57\u7b26\u6d41\uff1f\u300d<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Java \u4e2d\u5b57\u7b26\u662f\u91c7\u7528 Unicode \u6807\u51c6\uff0cUnicode \u7f16\u7801\u4e2d\uff0c\u4e00\u4e2a\u82f1\u6587\u5b57\u6bcd\u6216\u4e00\u4e2a\u4e2d\u6587\u6c49\u5b57\u4e3a\u4e24\u4e2a\u5b57\u8282\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io2.png\" alt=\"\u4e3a\u4ec0\u4e48\u8981\u6709\u5b57\u7b26\u6d41\" \/><figcaption>\u4e3a\u4ec0\u4e48\u8981\u6709\u5b57\u7b26\u6d41<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u800c\u5728 UTF-8 \u7f16\u7801\u4e2d\uff0c\u4e00\u4e2a\u4e2d\u6587\u5b57\u7b26\u662f 3 \u4e2a\u5b57\u8282\u3002\u4f8b\u5982\u4e0b\u9762\u56fe\u4e2d\uff0c\u201c<code>\u4e91\u6df1\u4e0d\u77e5\u5904<\/code>\u201d 5 \u4e2a\u4e2d\u6587\u5bf9\u5e94\u7684\u662f 15 \u4e2a\u5b57\u8282\uff1a-28-70-111-26-73-79-28-72-115-25-97-91-27-92-124\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io3.png\" alt=\"Unicode \u7f16\u7801\" \/><figcaption>Unicode \u7f16\u7801<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u90a3\u4e48\u95ee\u9898\u6765\u4e86\uff0c\u5982\u679c\u4f7f\u7528\u5b57\u8282\u6d41\u5904\u7406\u4e2d\u6587\uff0c\u5982\u679c\u4e00\u6b21\u8bfb\u5199\u4e00\u4e2a\u5b57\u7b26\u5bf9\u5e94\u7684\u5b57\u8282\u6570\u5c31\u4e0d\u4f1a\u6709\u95ee\u9898\uff0c\u4e00\u65e6\u5c06\u4e00\u4e2a\u5b57\u7b26\u5bf9\u5e94\u7684\u5b57\u8282\u5206\u88c2\u5f00\u6765\uff0c\u5c31\u4f1a\u51fa\u73b0\u4e71\u7801\u4e86\u3002\u4e3a\u4e86\u66f4\u65b9\u4fbf\u5730\u5904\u7406\u4e2d\u6587\u8fd9\u4e9b\u5b57\u7b26\uff0cJava \u5c31\u63a8\u51fa\u4e86\u5b57\u7b26\u6d41\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u8282\u6d41\u548c\u5b57\u7b26\u6d41\u7684\u5176\u4ed6\u533a\u522b\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>\u5b57\u8282\u6d41\u4e00\u822c\u7528\u6765\u5904\u7406\u56fe\u50cf\u3001\u89c6\u9891\u3001\u97f3\u9891\u3001PPT\u3001Word \u7b49\u7c7b\u578b\u7684\u6587\u4ef6\u3002\u5b57\u7b26\u6d41\u4e00\u822c\u7528\u4e8e\u5904\u7406\u7eaf\u6587\u672c\u7c7b\u578b\u7684\u6587\u4ef6\uff0c\u5982TXT\u6587\u4ef6\u7b49\uff0c\u4f46\u4e0d\u80fd\u5904\u7406\u56fe\u50cf\u89c6\u9891\u7b49\u975e\u6587\u672c\u6587\u4ef6\u3002\u7528\u4e00\u53e5\u8bdd\u8bf4\u5c31\u662f\uff1a\u5b57\u8282\u6d41\u53ef\u4ee5\u5904\u7406\u4e00\u5207\u6587\u4ef6\uff0c\u800c\u5b57\u7b26\u6d41\u53ea\u80fd\u5904\u7406\u7eaf\u6587\u672c\u6587\u4ef6\u3002<\/li><li>\u5b57\u8282\u6d41\u672c\u8eab\u6ca1\u6709\u7f13\u51b2\u533a\uff0c\u7f13\u51b2\u5b57\u8282\u6d41\u76f8\u5bf9\u4e8e\u5b57\u8282\u6d41\uff0c\u6548\u7387\u63d0\u5347\u975e\u5e38\u9ad8\u3002\u800c\u5b57\u7b26\u6d41\u672c\u8eab\u5c31\u5e26\u6709\u7f13\u51b2\u533a\uff0c\u7f13\u51b2\u5b57\u7b26\u6d41\u76f8\u5bf9\u4e8e\u5b57\u7b26\u6d41\u6548\u7387\u63d0\u5347\u5c31\u4e0d\u662f\u90a3\u4e48\u5927\u4e86\u3002\u8be6\u89c1\u6587\u672b\u6548\u7387\u5bf9\u6bd4\u3002<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u5199\u6587\u4ef6\u4e3a\u4f8b\uff0c\u6211\u4eec\u67e5\u770b\u5b57\u7b26\u6d41\u7684\u6e90\u7801\uff0c\u53d1\u73b0\u786e\u5b9e\u6709\u5229\u7528\u5230\u7f13\u51b2\u533a\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io4.png\" alt=\"\u5b57\u7b26\u6d41\u7684\u6e90\u7801\" \/><figcaption>\u5b57\u7b26\u6d41\u7684\u6e90\u7801<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io5.png\" alt=\"\u7f13\u51b2\u533a\" \/><figcaption>\u7f13\u51b2\u533a<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c3\u3001\u8282\u70b9\u6d41\u548c\u5904\u7406\u6d41\u300d<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c\u8282\u70b9\u6d41\u300d<\/strong>\uff1a\u76f4\u63a5\u64cd\u4f5c\u6570\u636e\u8bfb\u5199\u7684\u6d41\u7c7b\uff0c\u6bd4\u5982<code>FileInputStream<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c\u5904\u7406\u6d41\u300d<\/strong>\uff1a\u5bf9\u4e00\u4e2a\u5df2\u5b58\u5728\u7684\u6d41\u7684\u94fe\u63a5\u548c\u5c01\u88c5\uff0c\u901a\u8fc7\u5bf9\u6570\u636e\u8fdb\u884c\u5904\u7406\u4e3a\u7a0b\u5e8f\u63d0\u4f9b\u529f\u80fd\u5f3a\u5927\u3001\u7075\u6d3b\u7684\u8bfb\u5199\u529f\u80fd\uff0c\u4f8b\u5982<code>BufferedInputStream<\/code>\uff08\u7f13\u51b2\u5b57\u8282\u6d41\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5904\u7406\u6d41\u548c\u8282\u70b9\u6d41\u5e94\u7528\u4e86Java\u7684\u88c5\u9970\u8005\u8bbe\u8ba1\u6a21\u5f0f\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0b\u56fe\u5c31\u5f88\u5f62\u8c61\u5730\u63cf\u7ed8\u4e86\u8282\u70b9\u6d41\u548c\u5904\u7406\u6d41\uff0c\u5904\u7406\u6d41\u662f\u5bf9\u8282\u70b9\u6d41\u7684\u5c01\u88c5\uff0c\u6700\u7ec8\u7684\u6570\u636e\u5904\u7406\u8fd8\u662f\u7531\u8282\u70b9\u6d41\u5b8c\u6210\u7684\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io6.png\" alt=\"\u8282\u70b9\u6d41\u548c\u5904\u7406\u6d41\" \/><figcaption>\u8282\u70b9\u6d41\u548c\u5904\u7406\u6d41<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u5728\u8bf8\u591a\u5904\u7406\u6d41\u4e2d\uff0c\u6709\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\uff0c\u90a3\u5c31\u662f<strong>\u300c\u7f13\u51b2\u6d41\u300d<\/strong>\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6211\u4eec\u77e5\u9053\uff0c\u7a0b\u5e8f\u4e0e\u78c1\u76d8\u7684\u4ea4\u4e92\u76f8\u5bf9\u4e8e\u5185\u5b58\u8fd0\u7b97\u662f\u5f88\u6162\u7684\uff0c\u5bb9\u6613\u6210\u4e3a\u7a0b\u5e8f\u7684\u6027\u80fd\u74f6\u9888\u3002\u51cf\u5c11\u7a0b\u5e8f\u4e0e\u78c1\u76d8\u7684\u4ea4\u4e92\uff0c\u662f\u63d0\u5347\u7a0b\u5e8f\u6548\u7387\u4e00\u79cd\u6709\u6548\u624b\u6bb5\u3002\u7f13\u51b2\u6d41\uff0c\u5c31\u5e94\u7528\u8fd9\u79cd\u601d\u8def\uff1a\u666e\u901a\u6d41\u6bcf\u6b21\u8bfb\u5199\u4e00\u4e2a\u5b57\u8282\uff0c\u800c\u7f13\u51b2\u6d41\u5728\u5185\u5b58\u4e2d\u8bbe\u7f6e\u4e00\u4e2a\u7f13\u5b58\u533a\uff0c\u7f13\u51b2\u533a\u5148\u5b58\u50a8\u8db3\u591f\u7684\u5f85\u64cd\u4f5c\u6570\u636e\u540e\uff0c\u518d\u4e0e\u5185\u5b58\u6216\u78c1\u76d8\u8fdb\u884c\u4ea4\u4e92\u3002\u8fd9\u6837\uff0c\u5728\u603b\u6570\u636e\u91cf\u4e0d\u53d8\u7684\u60c5\u51b5\u4e0b\uff0c\u901a\u8fc7\u63d0\u9ad8\u6bcf\u6b21\u4ea4\u4e92\u7684\u6570\u636e\u91cf\uff0c\u51cf\u5c11\u4e86\u4ea4\u4e92\u6b21\u6570\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io7.png\" alt=\"\u7f13\u5b58\u5b57\u8282\u6d41\" \/><figcaption>\u7f13\u5b58\u5b57\u8282\u6d41<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u8054\u60f3\u4e00\u4e0b\u751f\u6d3b\u4e2d\u7684\u4f8b\u5b50\uff0c\u6211\u4eec\u642c\u7816\u7684\u65f6\u5019\uff0c\u4e00\u5757\u4e00\u5757\u5730\u5f80\u8f66\u4e0a\u88c5\u80af\u5b9a\u662f\u5f88\u4f4e\u6548\u7684\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u5c0f\u63a8\u8f66\uff0c\u5148\u628a\u7816\u88c5\u5230\u5c0f\u63a8\u8f66\u4e0a\uff0c\u518d\u628a\u8fd9\u5c0f\u63a8\u8f66\u63a8\u5230\u8f66\u524d\uff0c\u628a\u7816\u88c5\u5230\u8f66\u4e0a\u3002\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5c0f\u63a8\u8f66\u53ef\u4ee5\u89c6\u4e3a\u7f13\u51b2\u533a\uff0c\u5c0f\u63a8\u8f66\u7684\u5b58\u5728\uff0c\u51cf\u5c11\u4e86\u6211\u4eec\u88c5\u8f66\u6b21\u6570\uff0c\u4ece\u800c\u63d0\u9ad8\u4e86\u6548\u7387\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io8.png\" alt=\"\u7f13\u51b2\u6d41\u6548\u7387\u4e00\u5b9a\u9ad8\u5417\" \/><figcaption>\u7f13\u51b2\u6d41\u6548\u7387\u4e00\u5b9a\u9ad8\u5417<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u7f13\u51b2\u6d41\u6548\u7387\u4e00\u5b9a\u9ad8\u5417\uff1f\u4e0d\u4e00\u5b9a\uff0c\u67d0\u4e9b\u60c5\u5f62\u4e0b\uff0c\u7f13\u51b2\u6d41\u6548\u7387\u53cd\u800c\u66f4\u4f4e\uff0c\u5177\u4f53\u8bf7\u89c1 IO \u6d41\u6548\u7387\u5bf9\u6bd4\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b8c\u6574\u7684 IO \u5206\u7c7b\u56fe\u5982\u4e0b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io9.png\" alt=\"IO \u5206\u7c7b\u56fe\" \/><figcaption>IO \u5206\u7c7b\u56fe<\/figcaption><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u6848\u4f8b\u5b9e\u64cd<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u770b\u770b\u5982\u4f55\u4f7f\u7528 Java IO\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c\u6587\u672c\u8bfb\u5199\u7684\u4f8b\u5b50\u300d<\/strong>\uff0c\u4e5f\u5c31\u662f\u6587\u7ae0\u5f00\u5934\u6240\u8bf4\u7684\uff0c\u5c06\u201c\u677e\u4e0b\u95ee\u7ae5\u5b50\uff0c\u8a00\u5e08\u91c7\u836f\u53bb\u3002\u53ea\u5728\u6b64\u5c71\u4e2d\uff0c\u4e91\u6df1\u4e0d\u77e5\u5904\u3002\u201d\u5199\u5165\u672c\u5730\u6587\u672c\uff0c\u7136\u540e\u518d\u4ece\u6587\u4ef6\u8bfb\u53d6\u5185\u5bb9\u5e76\u8f93\u51fa\u5230\u63a7\u5236\u53f0\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c1\u3001FileInputStream\u3001FileOutputStream\uff08\u5b57\u8282\u6d41\uff09\u300d<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>\u275d<\/strong><\/p><p><strong>\u300c\u5b57\u8282\u6d41\u7684\u65b9\u5f0f\u6548\u7387\u8f83\u4f4e\uff0c\u4e0d\u5efa\u8bae\u4f7f\u7528\u300d<\/strong>\u275e<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>public class IOTest {\n\tpublic static void main(String[] args) throws IOException {\n\t\tFile file = new File(\"D:\/test.txt\");\n\n\t\twrite(file);\n\t\tSystem.out.println(read(file));\n\t}\n\n\tpublic static void write(File file) throws IOException {\n\t\tOutputStream os = new FileOutputStream(file, true);\n\n\t\t\/\/ \u8981\u5199\u5165\u7684\u5b57\u7b26\u4e32\n\t\tString string = \"\u677e\u4e0b\u95ee\u7ae5\u5b50\uff0c\u8a00\u5e08\u91c7\u836f\u53bb\u3002\u53ea\u5728\u6b64\u5c71\u4e2d\uff0c\u4e91\u6df1\u4e0d\u77e5\u5904\u3002\";\n\t\t\/\/ \u5199\u5165\u6587\u4ef6\n\t\tos.write(string.getBytes());\n\t\t\/\/ \u5173\u95ed\u6d41\n\t\tos.close();\n\t}\n\n\tpublic static String read(File file) throws IOException {\n\t\tInputStream in = new FileInputStream(file);\n\n\t\t\/\/ \u4e00\u6b21\u6027\u53d6\u591a\u5c11\u4e2a\u5b57\u8282\n\t\tbyte[] bytes = new byte[1024];\n\t\t\/\/ \u7528\u6765\u63a5\u6536\u8bfb\u53d6\u7684\u5b57\u8282\u6570\u7ec4\n\t\tStringBuilder sb = new StringBuilder();\n\t\t\/\/ \u8bfb\u53d6\u5230\u7684\u5b57\u8282\u6570\u7ec4\u957f\u5ea6\uff0c\u4e3a-1\u65f6\u8868\u793a\u6ca1\u6709\u6570\u636e\n\t\tint length = 0;\n\t\t\/\/ \u5faa\u73af\u53d6\u6570\u636e\n\t\twhile ((length = in.read(bytes)) != -1) {\n\t\t\t\/\/ \u5c06\u8bfb\u53d6\u7684\u5185\u5bb9\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\n\t\t\tsb.append(new String(bytes, 0, length));\n\t\t}\n\t\t\/\/ \u5173\u95ed\u6d41\n\t\tin.close();\n\n\t\treturn sb.toString();\n\t}\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c2\u3001BufferedInputStream\u3001BufferedOutputStream\uff08\u7f13\u51b2\u5b57\u8282\u6d41\uff09\u300d<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>\u275d<\/strong><\/p><p>\u7f13\u51b2\u5b57\u8282\u6d41\u662f\u4e3a\u9ad8\u6548\u7387\u800c\u8bbe\u8ba1\u7684\uff0c\u771f\u6b63\u7684\u8bfb\u5199\u64cd\u4f5c\u8fd8\u662f\u9760<code>FileOutputStream<\/code>\u548c<code>FileInputStream<\/code>\uff0c\u6240\u4ee5\u5176\u6784\u9020\u65b9\u6cd5\u5165\u53c2\u662f\u8fd9\u4e24\u4e2a\u7c7b\u7684\u5bf9\u8c61\u4e5f\u5c31\u4e0d\u5947\u602a\u4e86\u3002\u275e<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>public class IOTest {\n\n\tpublic static void write(File file) throws IOException {\n\t\t\/\/ \u7f13\u51b2\u5b57\u8282\u6d41\uff0c\u63d0\u9ad8\u4e86\u6548\u7387\n\t\tBufferedOutputStream bis = new BufferedOutputStream(new FileOutputStream(file, true));\n\n\t\t\/\/ \u8981\u5199\u5165\u7684\u5b57\u7b26\u4e32\n\t\tString string = \"\u677e\u4e0b\u95ee\u7ae5\u5b50\uff0c\u8a00\u5e08\u91c7\u836f\u53bb\u3002\u53ea\u5728\u6b64\u5c71\u4e2d\uff0c\u4e91\u6df1\u4e0d\u77e5\u5904\u3002\";\n\t\t\/\/ \u5199\u5165\u6587\u4ef6\n\t\tbis.write(string.getBytes());\n\t\t\/\/ \u5173\u95ed\u6d41\n\t\tbis.close();\n\t}\n\n\tpublic static String read(File file) throws IOException {\n\t\tBufferedInputStream fis = new BufferedInputStream(new FileInputStream(file));\n\n\t\t\/\/ \u4e00\u6b21\u6027\u53d6\u591a\u5c11\u4e2a\u5b57\u8282\n\t\tbyte[] bytes = new byte[1024];\n\t\t\/\/ \u7528\u6765\u63a5\u6536\u8bfb\u53d6\u7684\u5b57\u8282\u6570\u7ec4\n\t\tStringBuilder sb = new StringBuilder();\n\t\t\/\/ \u8bfb\u53d6\u5230\u7684\u5b57\u8282\u6570\u7ec4\u957f\u5ea6\uff0c\u4e3a-1\u65f6\u8868\u793a\u6ca1\u6709\u6570\u636e\n\t\tint length = 0;\n\t\t\/\/ \u5faa\u73af\u53d6\u6570\u636e\n\t\twhile ((length = fis.read(bytes)) != -1) {\n\t\t\t\/\/ \u5c06\u8bfb\u53d6\u7684\u5185\u5bb9\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\n\t\t\tsb.append(new String(bytes, 0, length));\n\t\t}\n\t\t\/\/ \u5173\u95ed\u6d41\n\t\tfis.close();\n\n\t\treturn sb.toString();\n\t}\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c3\u3001InputStreamReader\u3001OutputStreamWriter\uff08\u5b57\u7b26\u6d41\uff09\u300d<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>\u275d<\/strong><\/p><p><strong>\u300c\u5b57\u7b26\u6d41\u9002\u7528\u4e8e\u6587\u672c\u6587\u4ef6\u7684\u8bfb\u5199\u300d<\/strong>\uff0c<code>OutputStreamWriter<\/code>\u7c7b\u5176\u5b9e\u4e5f\u662f\u501f\u52a9<code>FileOutputStream<\/code>\u7c7b\u5b9e\u73b0\u7684\uff0c\u6545\u5176\u6784\u9020\u65b9\u6cd5\u662f<code>FileOutputStream<\/code>\u7684\u5bf9\u8c61\u275e<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>public class IOTest {\n\t\n\tpublic static void write(File file) throws IOException {\n\t\t\/\/ OutputStreamWriter\u53ef\u4ee5\u663e\u793a\u6307\u5b9a\u5b57\u7b26\u96c6\uff0c\u5426\u5219\u4f7f\u7528\u9ed8\u8ba4\u5b57\u7b26\u96c6\n\t\tOutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(file, true), \"UTF-8\");\n\n\t\t\/\/ \u8981\u5199\u5165\u7684\u5b57\u7b26\u4e32\n\t\tString string = \"\u677e\u4e0b\u95ee\u7ae5\u5b50\uff0c\u8a00\u5e08\u91c7\u836f\u53bb\u3002\u53ea\u5728\u6b64\u5c71\u4e2d\uff0c\u4e91\u6df1\u4e0d\u77e5\u5904\u3002\";\n\t\tosw.write(string);\n\t\tosw.close();\n\t}\n\n\tpublic static String read(File file) throws IOException {\n\t\tInputStreamReader isr = new InputStreamReader(new FileInputStream(file), \"UTF-8\");\n\t\t\/\/ \u5b57\u7b26\u6570\u7ec4\uff1a\u4e00\u6b21\u8bfb\u53d6\u591a\u5c11\u4e2a\u5b57\u7b26\n\t\tchar[] chars = new char[1024];\n\t\t\/\/ \u6bcf\u6b21\u8bfb\u53d6\u7684\u5b57\u7b26\u6570\u7ec4\u5148append\u5230StringBuilder\u4e2d\n\t\tStringBuilder sb = new StringBuilder();\n\t\t\/\/ \u8bfb\u53d6\u5230\u7684\u5b57\u7b26\u6570\u7ec4\u957f\u5ea6\uff0c\u4e3a-1\u65f6\u8868\u793a\u6ca1\u6709\u6570\u636e\n\t\tint length;\n\t\t\/\/ \u5faa\u73af\u53d6\u6570\u636e\n\t\twhile ((length = isr.read(chars)) != -1) {\n\t\t\t\/\/ \u5c06\u8bfb\u53d6\u7684\u5185\u5bb9\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\n\t\t\tsb.append(chars, 0, length);\n\t\t}\n\t\t\/\/ \u5173\u95ed\u6d41\n\t\tisr.close();\n\n\t\treturn sb.toString()\n\t}\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c4\u3001\u5b57\u7b26\u6d41\u4fbf\u6377\u7c7b\u300d<\/strong><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>\u275d<\/strong><\/p><p>Java\u63d0\u4f9b\u4e86<code>FileWriter<\/code>\u548c<code>FileReader<\/code>\u7b80\u5316\u5b57\u7b26\u6d41\u7684\u8bfb\u5199\uff0c<code>new FileWriter<\/code>\u7b49\u540c\u4e8e<code>new OutputStreamWriter(new FileOutputStream(file, true))<\/code>\u275e<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>public class IOTest {\n\t\n\tpublic static void write(File file) throws IOException {\n\t\tFileWriter fw = new FileWriter(file, true);\n\n\t\t\/\/ \u8981\u5199\u5165\u7684\u5b57\u7b26\u4e32\n\t\tString string = \"\u677e\u4e0b\u95ee\u7ae5\u5b50\uff0c\u8a00\u5e08\u91c7\u836f\u53bb\u3002\u53ea\u5728\u6b64\u5c71\u4e2d\uff0c\u4e91\u6df1\u4e0d\u77e5\u5904\u3002\";\n\t\tfw.write(string);\n\t\tfw.close();\n\t}\n\n\tpublic static String read(File file) throws IOException {\n\t\tFileReader fr = new FileReader(file);\n\t\t\/\/ \u4e00\u6b21\u6027\u53d6\u591a\u5c11\u4e2a\u5b57\u8282\n\t\tchar[] chars = new char[1024];\n\t\t\/\/ \u7528\u6765\u63a5\u6536\u8bfb\u53d6\u7684\u5b57\u8282\u6570\u7ec4\n\t\tStringBuilder sb = new StringBuilder();\n\t\t\/\/ \u8bfb\u53d6\u5230\u7684\u5b57\u8282\u6570\u7ec4\u957f\u5ea6\uff0c\u4e3a-1\u65f6\u8868\u793a\u6ca1\u6709\u6570\u636e\n\t\tint length;\n\t\t\/\/ \u5faa\u73af\u53d6\u6570\u636e\n\t\twhile ((length = fr.read(chars)) != -1) {\n\t\t\t\/\/ \u5c06\u8bfb\u53d6\u7684\u5185\u5bb9\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\n\t\t\tsb.append(chars, 0, length);\n\t\t}\n\t\t\/\/ \u5173\u95ed\u6d41\n\t\tfr.close();\n\n\t\treturn sb.toString();\n\t}\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300c5\u3001BufferedReader\u3001BufferedWriter\uff08\u5b57\u7b26\u7f13\u51b2\u6d41\uff09\u300d<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class IOTest {\n\t\n\tpublic static void write(File file) throws IOException {\n\t\t\/\/ BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new\n\t\t\/\/ FileOutputStream(file, true), \"UTF-8\"));\n\t\t\/\/ FileWriter\u53ef\u4ee5\u5927\u5e45\u5ea6\u7b80\u5316\u4ee3\u7801\n\t\tBufferedWriter bw = new BufferedWriter(new FileWriter(file, true));\n\n\t\t\/\/ \u8981\u5199\u5165\u7684\u5b57\u7b26\u4e32\n\t\tString string = \"\u677e\u4e0b\u95ee\u7ae5\u5b50\uff0c\u8a00\u5e08\u91c7\u836f\u53bb\u3002\u53ea\u5728\u6b64\u5c71\u4e2d\uff0c\u4e91\u6df1\u4e0d\u77e5\u5904\u3002\";\n\t\tbw.write(string);\n\t\tbw.close();\n\t}\n\n\tpublic static String read(File file) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(file));\n\t\t\/\/ \u7528\u6765\u63a5\u6536\u8bfb\u53d6\u7684\u5b57\u8282\u6570\u7ec4\n\t\tStringBuilder sb = new StringBuilder();\n\n\t\t\/\/ \u6309\u884c\u8bfb\u6570\u636e\n\t\tString line;\n\t\t\/\/ \u5faa\u73af\u53d6\u6570\u636e\n\t\twhile ((line = br.readLine()) != null) {\n\t\t\t\/\/ \u5c06\u8bfb\u53d6\u7684\u5185\u5bb9\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\n\t\t\tsb.append(line);\n\t\t}\n\t\t\/\/ \u5173\u95ed\u6d41\n\t\tbr.close();\n\n\t\treturn sb.toString();\n\t}\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">IO\u6d41\u5bf9\u8c61<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b2c\u4e00\u8282\u4e2d\uff0c\u6211\u4eec\u5927\u81f4\u4e86\u89e3\u4e86IO\uff0c\u5e76\u5b8c\u6210\u4e86\u51e0\u4e2a\u6848\u4f8b\uff0c\u4f46\u5bf9IO\u8fd8\u7f3a\u4e4f\u66f4\u8be6\u7ec6\u7684\u8ba4\u77e5\uff0c\u90a3\u4e48\u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u5bf9Java IO\u7ec6\u7ec6\u5206\u89e3\uff0c\u68b3\u7406\u51fa\u5b8c\u6574\u7684\u77e5\u8bc6\u4f53\u7cfb\u6765\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Java\u79cd\u63d0\u4f9b\u4e8640\u591a\u4e2a\u7c7b\uff0c\u6211\u4eec\u53ea\u9700\u8981\u8be6\u7ec6\u4e86\u89e3\u4e00\u4e0b\u5176\u4e2d\u6bd4\u8f83\u91cd\u8981\u7684\u5c31\u53ef\u4ee5\u6ee1\u8db3\u65e5\u5e38\u5e94\u7528\u4e86\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">File\u7c7b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>File<\/code>\u7c7b\u662f\u7528\u6765\u64cd\u4f5c\u6587\u4ef6\u7684\u7c7b\uff0c\u4f46\u5b83\u4e0d\u80fd\u64cd\u4f5c\u6587\u4ef6\u4e2d\u7684\u6570\u636e\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class File extends Object implements Serializable, Comparable&lt;File&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>File<\/code>\u7c7b\u5b9e\u73b0\u4e86<code>Serializable<\/code>\u3001 <code>Comparable&lt;File&gt;<\/code>\uff0c\u8bf4\u660e\u5b83\u662f\u652f\u6301\u5e8f\u5217\u5316\u548c\u6392\u5e8f\u7684\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300cFile\u7c7b\u7684\u6784\u9020\u65b9\u6cd5\u300d<\/strong><\/p>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>\u65b9\u6cd5\u540d<\/th><th>\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td><code>File(File parent, String child)<\/code><\/td><td>\u6839\u636e parent \u62bd\u8c61\u8def\u5f84\u540d\u548c child \u8def\u5f84\u540d\u5b57\u7b26\u4e32\u521b\u5efa\u4e00\u4e2a\u65b0 File \u5b9e\u4f8b\u3002<\/td><\/tr><tr><td><code>File(String pathname)<\/code><\/td><td>\u901a\u8fc7\u5c06\u7ed9\u5b9a\u8def\u5f84\u540d\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u62bd\u8c61\u8def\u5f84\u540d\u6765\u521b\u5efa\u4e00\u4e2a\u65b0 File \u5b9e\u4f8b\u3002<\/td><\/tr><tr><td><code>File(String parent, String child)<\/code><\/td><td>\u6839\u636e parent \u8def\u5f84\u540d\u5b57\u7b26\u4e32\u548c child \u8def\u5f84\u540d\u5b57\u7b26\u4e32\u521b\u5efa\u4e00\u4e2a\u65b0 File \u5b9e\u4f8b\u3002<\/td><\/tr><tr><td><code>File(URI uri)<\/code><\/td><td>\u901a\u8fc7\u5c06\u7ed9\u5b9a\u7684 file: URI \u8f6c\u6362\u4e3a\u4e00\u4e2a\u62bd\u8c61\u8def\u5f84\u540d\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 File \u5b9e\u4f8b\u3002<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300cFile\u7c7b\u7684\u5e38\u7528\u65b9\u6cd5\u300d<\/strong><\/p>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><th>\u65b9\u6cd5<\/th><th>\u8bf4\u660e<\/th><\/tr><\/thead><tbody><tr><td><code>createNewFile()<\/code><\/td><td>\u5f53\u4e14\u4ec5\u5f53\u4e0d\u5b58\u5728\u5177\u6709\u6b64\u62bd\u8c61\u8def\u5f84\u540d\u6307\u5b9a\u540d\u79f0\u7684\u6587\u4ef6\u65f6\uff0c\u4e0d\u53ef\u5206\u5730\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7a7a\u6587\u4ef6\u3002<\/td><\/tr><tr><td><code>delete()<\/code><\/td><td>\u5220\u9664\u6b64\u62bd\u8c61\u8def\u5f84\u540d\u8868\u793a\u7684\u6587\u4ef6\u6216\u76ee\u5f55\u3002<\/td><\/tr><tr><td><code>exists()<\/code><\/td><td>\u6d4b\u8bd5\u6b64\u62bd\u8c61\u8def\u5f84\u540d\u8868\u793a\u7684\u6587\u4ef6\u6216\u76ee\u5f55\u662f\u5426\u5b58\u5728\u3002<\/td><\/tr><tr><td><code>getAbsoluteFile()<\/code><\/td><td>\u8fd4\u56de\u6b64\u62bd\u8c61\u8def\u5f84\u540d\u7684\u7edd\u5bf9\u8def\u5f84\u540d\u5f62\u5f0f\u3002<\/td><\/tr><tr><td><code>getAbsolutePath()<\/code><\/td><td>\u8fd4\u56de\u6b64\u62bd\u8c61\u8def\u5f84\u540d\u7684\u7edd\u5bf9\u8def\u5f84\u540d\u5b57\u7b26\u4e32\u3002<\/td><\/tr><tr><td><code>length()<\/code><\/td><td>\u8fd4\u56de\u7531\u6b64\u62bd\u8c61\u8def\u5f84\u540d\u8868\u793a\u7684\u6587\u4ef6\u7684\u957f\u5ea6\u3002<\/td><\/tr><tr><td><code>mkdir()<\/code><\/td><td>\u521b\u5efa\u6b64\u62bd\u8c61\u8def\u5f84\u540d\u6307\u5b9a\u7684\u76ee\u5f55\u3002<\/td><\/tr><\/tbody><\/table>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u300cFile\u7c7b\u4f7f\u7528\u5b9e\u4f8b\u300d<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class FileTest {\n\tpublic static void main(String[] args) throws IOException {\n\t\tFile file = new File(\"C:\/Mu\/fileTest.txt\");\n\n\t\t\/\/ \u5224\u65ad\u6587\u4ef6\u662f\u5426\u5b58\u5728\n\t\tif (!file.exists()) {\n\t\t\t\/\/ \u4e0d\u5b58\u5728\u5219\u521b\u5efa\n\t\t\tfile.createNewFile();\n\t\t}\n\t\tSystem.out.println(\"\u6587\u4ef6\u7684\u7edd\u5bf9\u8def\u5f84\uff1a\" + file.getAbsolutePath());\n\t\tSystem.out.println(\"\u6587\u4ef6\u7684\u5927\u5c0f\uff1a\" + file.length());\n\n\t\t\/\/ \u522a\u9664\u6587\u4ef6\n\t\tfile.delete();\n\t}\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u8282\u6d41<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>InputStream<\/code>\u4e0e<code>OutputStream<\/code>\u662f\u4e24\u4e2a\u62bd\u8c61\u7c7b\uff0c\u662f\u5b57\u8282\u6d41\u7684\u57fa\u7c7b\uff0c\u6240\u6709\u5177\u4f53\u7684\u5b57\u8282\u6d41\u5b9e\u73b0\u7c7b\u90fd\u662f\u5206\u522b\u7ee7\u627f\u4e86\u8fd9\u4e24\u4e2a\u7c7b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5<code>InputStream<\/code>\u4e3a\u4f8b\uff0c\u5b83\u7ee7\u627f\u4e86<code>Object<\/code>\uff0c\u5b9e\u73b0\u4e86<code>Closeable<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public abstract class InputStream\nextends Object\nimplements Closeable<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>InputStream<\/code>\u7c7b\u6709\u5f88\u591a\u7684\u5b9e\u73b0\u5b50\u7c7b\uff0c\u4e0b\u9762\u5217\u4e3e\u4e86\u4e00\u4e9b\u6bd4\u8f83\u5e38\u7528\u7684\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io10.png\" alt=\"InputStream\u5b50\u7c7b\" \/><figcaption>InputStream\u5b50\u7c7b<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u8be6\u7ec6\u8bf4\u660e\u4e00\u4e0b\u4e0a\u56fe\u4e2d\u7684\u7c7b\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><code>InputStream<\/code>\uff1a<code>InputStream<\/code>\u662f\u6240\u6709\u5b57\u8282\u8f93\u5165\u6d41\u7684\u62bd\u8c61\u57fa\u7c7b\uff0c\u524d\u9762\u8bf4\u8fc7\u62bd\u8c61\u7c7b\u4e0d\u80fd\u88ab\u5b9e\u4f8b\u5316\uff0c\u5b9e\u9645\u4e0a\u662f\u4f5c\u4e3a\u6a21\u677f\u800c\u5b58\u5728\u7684\uff0c\u4e3a\u6240\u6709\u5b9e\u73b0\u7c7b\u5b9a\u4e49\u4e86\u5904\u7406\u8f93\u5165\u6d41\u7684\u65b9\u6cd5\u3002<\/li><li><code>FileInputSream<\/code>\uff1a\u6587\u4ef6\u8f93\u5165\u6d41\uff0c\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u5b57\u8282\u8f93\u5165\u6d41\uff0c\u7528\u4e8e\u5bf9\u6587\u4ef6\u8fdb\u884c\u8bfb\u53d6\u64cd\u4f5c\u3002<\/li><li><code>PipedInputStream<\/code>\uff1a\u7ba1\u9053\u5b57\u8282\u8f93\u5165\u6d41\uff0c\u80fd\u5b9e\u73b0\u591a\u7ebf\u7a0b\u95f4\u7684\u7ba1\u9053\u901a\u4fe1\u3002<\/li><li><code>ByteArrayInputStream<\/code>\uff1a\u5b57\u8282\u6570\u7ec4\u8f93\u5165\u6d41\uff0c\u4ece\u5b57\u8282\u6570\u7ec4(byte[])\u4e2d\u8fdb\u884c\u4ee5\u5b57\u8282\u4e3a\u5355\u4f4d\u7684\u8bfb\u53d6\uff0c\u4e5f\u5c31\u662f\u5c06\u8d44\u6e90\u6587\u4ef6\u90fd\u4ee5\u5b57\u8282\u7684\u5f62\u5f0f\u5b58\u5165\u5230\u8be5\u7c7b\u4e2d\u7684\u5b57\u8282\u6570\u7ec4\u4e2d\u53bb\u3002<\/li><li><code>FilterInputStream<\/code>\uff1a\u88c5\u9970\u8005\u7c7b\uff0c\u5177\u4f53\u7684\u88c5\u9970\u8005\u7ee7\u627f\u8be5\u7c7b\uff0c\u8fd9\u4e9b\u7c7b\u90fd\u662f\u5904\u7406\u7c7b\uff0c\u4f5c\u7528\u662f\u5bf9\u8282\u70b9\u7c7b\u8fdb\u884c\u5c01\u88c5\uff0c\u5b9e\u73b0\u4e00\u4e9b\u7279\u6b8a\u529f\u80fd\u3002<\/li><li><code>DataInputStream<\/code>\uff1a\u6570\u636e\u8f93\u5165\u6d41\uff0c\u5b83\u662f\u7528\u6765\u88c5\u9970\u5176\u5b83\u8f93\u5165\u6d41\uff0c\u4f5c\u7528\u662f\u201c\u5141\u8bb8\u5e94\u7528\u7a0b\u5e8f\u4ee5\u4e0e\u673a\u5668\u65e0\u5173\u65b9\u5f0f\u4ece\u5e95\u5c42\u8f93\u5165\u6d41\u4e2d\u8bfb\u53d6\u57fa\u672c Java \u6570\u636e\u7c7b\u578b\u201d\u3002<\/li><li><code>BufferedInputStream<\/code>\uff1a\u7f13\u51b2\u6d41\uff0c\u5bf9\u8282\u70b9\u6d41\u8fdb\u884c\u88c5\u9970\uff0c\u5185\u90e8\u4f1a\u6709\u4e00\u4e2a\u7f13\u5b58\u533a\uff0c\u7528\u6765\u5b58\u653e\u5b57\u8282\uff0c\u6bcf\u6b21\u90fd\u662f\u5c06\u7f13\u5b58\u533a\u5b58\u6ee1\u7136\u540e\u53d1\u9001\uff0c\u800c\u4e0d\u662f\u4e00\u4e2a\u5b57\u8282\u6216\u4e24\u4e2a\u5b57\u8282\u8fd9\u6837\u53d1\u9001\uff0c\u6548\u7387\u66f4\u9ad8\u3002<\/li><li><code>ObjectInputStream<\/code>\uff1a\u5bf9\u8c61\u8f93\u5165\u6d41\uff0c\u7528\u6765\u63d0\u4f9b\u5bf9<strong>\u300c\u57fa\u672c\u6570\u636e\u6216\u5bf9\u8c61\u300d<\/strong>\u7684\u6301\u4e45\u5b58\u50a8\u3002\u901a\u4fd7\u70b9\u8bf4\uff0c\u4e5f\u5c31\u662f\u80fd\u76f4\u63a5\u4f20\u8f93\u5bf9\u8c61\uff0c\u901a\u5e38\u5e94\u7528\u5728\u53cd\u5e8f\u5217\u5316\u4e2d\u3002\u5b83\u4e5f\u662f\u4e00\u79cd\u5904\u7406\u6d41\uff0c\u6784\u9020\u5668\u7684\u5165\u53c2\u662f\u4e00\u4e2a<code>InputStream<\/code>\u7684\u5b9e\u4f8b\u5bf9\u8c61\u3002<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><code>OutputStream<\/code>\u7c7b\u7ee7\u627f\u5173\u7cfb\u56fe\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io11.png\" alt=\"OutputStream\u7c7b\u7ee7\u627f\u5173\u7cfb\u56fe\" \/><figcaption>OutputStream\u7c7b\u7ee7\u627f\u5173\u7cfb\u56fe<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><code>OutputStream<\/code>\u7c7b\u7ee7\u627f\u5173\u7cfb\u4e0e<code>InputStream<\/code>\u7c7b\u4f3c\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f<code>PrintStream<\/code>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u6d41<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e0e\u5b57\u8282\u6d41\u7c7b\u4f3c\uff0c\u5b57\u7b26\u6d41\u4e5f\u6709\u4e24\u4e2a\u62bd\u8c61\u57fa\u7c7b\uff0c\u5206\u522b\u662f<code>Reader<\/code>\u548c<code>Writer<\/code>\u3002\u5176\u4ed6\u7684\u5b57\u7b26\u6d41\u5b9e\u73b0\u7c7b\u90fd\u662f\u7ee7\u627f\u4e86\u8fd9\u4e24\u4e2a\u7c7b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5<code>Reader<\/code>\u4e3a\u4f8b\uff0c\u5b83\u7684\u4e3b\u8981\u5b9e\u73b0\u5b50\u7c7b\u5982\u4e0b\u56fe\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/xmt1139057136\/xttblog\/2021\/12\/io12.png\" alt=\"\u5b57\u7b26\u6d41\" \/><figcaption>\u5b57\u7b26\u6d41<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\u5404\u4e2a\u7c7b\u7684\u8be6\u7ec6\u8bf4\u660e\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><code>InputStreamReader<\/code>\uff1a\u4ece\u5b57\u8282\u6d41\u5230\u5b57\u7b26\u6d41\u7684\u6865\u6881\uff08<code>InputStreamReader<\/code>\u6784\u9020\u5668\u5165\u53c2\u662f<code>FileInputStream<\/code>\u7684\u5b9e\u4f8b\u5bf9\u8c61\uff09\uff0c\u5b83\u8bfb\u53d6\u5b57\u8282\u5e76\u4f7f\u7528\u6307\u5b9a\u7684\u5b57\u7b26\u96c6\u5c06\u5176\u89e3\u7801\u4e3a\u5b57\u7b26\u3002\u5b83\u4f7f\u7528\u7684\u5b57\u7b26\u96c6\u53ef\u4ee5\u901a\u8fc7\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u663e\u5f0f\u7ed9\u5b9a\uff0c\u6216\u8005\u53ef\u4ee5\u63a5\u53d7\u5e73\u53f0\u7684\u9ed8\u8ba4\u5b57\u7b26\u96c6\u3002<\/li><li><code>BufferedReader<\/code>\uff1a\u4ece\u5b57\u7b26\u8f93\u5165\u6d41\u4e2d\u8bfb\u53d6\u6587\u672c\uff0c\u8bbe\u7f6e\u4e00\u4e2a\u7f13\u51b2\u533a\u6765\u63d0\u9ad8\u6548\u7387\u3002<code>BufferedReader<\/code>\u662f\u5bf9<code>InputStreamReader<\/code>\u7684\u5c01\u88c5\uff0c\u524d\u8005\u6784\u9020\u5668\u7684\u5165\u53c2\u5c31\u662f\u540e\u8005\u7684\u4e00\u4e2a\u5b9e\u4f8b\u5bf9\u8c61\u3002<\/li><li><code>FileReader<\/code>\uff1a\u7528\u4e8e\u8bfb\u53d6\u5b57\u7b26\u6587\u4ef6\u7684\u4fbf\u5229\u7c7b\uff0c<code>new FileReader(File file)<\/code>\u7b49\u540c\u4e8e<code>new InputStreamReader(new FileInputStream(file, true),\"UTF-8\")<\/code>\uff0c\u4f46<code>FileReader<\/code>\u4e0d\u80fd\u6307\u5b9a\u5b57\u7b26\u7f16\u7801\u548c\u9ed8\u8ba4\u5b57\u8282\u7f13\u51b2\u533a\u5927\u5c0f\u3002<\/li><li><code>PipedReader<\/code> \uff1a\u7ba1\u9053\u5b57\u7b26\u8f93\u5165\u6d41\u3002\u5b9e\u73b0\u591a\u7ebf\u7a0b\u95f4\u7684\u7ba1\u9053\u901a\u4fe1\u3002<\/li><li><code>CharArrayReader<\/code>\uff1a\u4ece<code>Char<\/code>\u6570\u7ec4\u4e2d\u8bfb\u53d6\u6570\u636e\u7684\u4ecb\u8d28\u6d41\u3002<\/li><li><code>StringReader<\/code> \uff1a\u4ece<code>String<\/code>\u4e2d\u8bfb\u53d6\u6570\u636e\u7684\u4ecb\u8d28\u6d41\u3002<\/li><\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Writer<\/code>\u4e0e<code>Reader<\/code>\u7ed3\u6784\u7c7b\u4f3c\uff0c\u65b9\u5411\u76f8\u53cd\uff0c\u4e0d\u518d\u8d58\u8ff0\u3002\u552f\u4e00\u6709\u533a\u522b\u7684\u662f\uff0c<code>Writer<\/code>\u7684\u5b50\u7c7b<code>PrintWriter<\/code>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5e8f\u5217\u5316<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f85\u7eed\u2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">IO\u6d41\u65b9\u6cd5<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u8282\u6d41\u65b9\u6cd5<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u8282\u8f93\u5165\u6d41<code>InputStream<\/code>\u4e3b\u8981\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>read()<\/code> \uff1a\u4ece\u6b64\u8f93\u5165\u6d41\u4e2d\u8bfb\u53d6\u4e00\u4e2a\u6570\u636e\u5b57\u8282\u3002<\/li><li><code>read(byte[] b)<\/code> \uff1a\u4ece\u6b64\u8f93\u5165\u6d41\u4e2d\u5c06\u6700\u591a b.length \u4e2a\u5b57\u8282\u7684\u6570\u636e\u8bfb\u5165\u4e00\u4e2a byte \u6570\u7ec4\u4e2d\u3002<\/li><li><code>read(byte[] b, int off, int len)<\/code> \uff1a\u4ece\u6b64\u8f93\u5165\u6d41\u4e2d\u5c06\u6700\u591a len \u4e2a\u5b57\u8282\u7684\u6570\u636e\u8bfb\u5165\u4e00\u4e2a byte \u6570\u7ec4\u4e2d\u3002<\/li><li><code>close()<\/code>\uff1a\u5173\u95ed\u6b64\u8f93\u5165\u6d41\u5e76\u91ca\u653e\u4e0e\u8be5\u6d41\u5173\u8054\u7684\u6240\u6709\u7cfb\u7edf\u8d44\u6e90\u3002<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u8282\u8f93\u51fa\u6d41<code>OutputStream<\/code>\u4e3b\u8981\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>write(byte[] b)<\/code> \uff1a\u5c06 b.length \u4e2a\u5b57\u8282\u4ece\u6307\u5b9a byte \u6570\u7ec4\u5199\u5165\u6b64\u6587\u4ef6\u8f93\u51fa\u6d41\u4e2d\u3002<\/li><li><code>write(byte[] b, int off, int len)<\/code> \uff1a\u5c06\u6307\u5b9a byte \u6570\u7ec4\u4e2d\u4ece\u504f\u79fb\u91cf off \u5f00\u59cb\u7684 len \u4e2a\u5b57\u8282\u5199\u5165\u6b64\u6587\u4ef6\u8f93\u51fa\u6d41\u3002<\/li><li><code>write(int b)<\/code> \uff1a\u5c06\u6307\u5b9a\u5b57\u8282\u5199\u5165\u6b64\u6587\u4ef6\u8f93\u51fa\u6d41\u3002<\/li><li><code>close()<\/code> \uff1a\u5173\u95ed\u6b64\u8f93\u5165\u6d41\u5e76\u91ca\u653e\u4e0e\u8be5\u6d41\u5173\u8054\u7684\u6240\u6709\u7cfb\u7edf\u8d44\u6e90\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b57\u7b26\u6d41\u65b9\u6cd5<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u7b26\u8f93\u5165\u6d41<code>Reader<\/code>\u4e3b\u8981\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>read()<\/code>\uff1a\u8bfb\u53d6\u5355\u4e2a\u5b57\u7b26\u3002<\/li><li><code>read(char[] cbuf)<\/code> \uff1a\u5c06\u5b57\u7b26\u8bfb\u5165\u6570\u7ec4\u3002<\/li><li><code>read(char[] cbuf, int off, int len)<\/code> \uff1a \u5c06\u5b57\u7b26\u8bfb\u5165\u6570\u7ec4\u7684\u67d0\u4e00\u90e8\u5206\u3002<\/li><li><code>read(CharBuffer target)<\/code> \uff1a\u8bd5\u56fe\u5c06\u5b57\u7b26\u8bfb\u5165\u6307\u5b9a\u7684\u5b57\u7b26\u7f13\u51b2\u533a\u3002<\/li><li><code>flush()<\/code> \uff1a\u5237\u65b0\u8be5\u6d41\u7684\u7f13\u51b2\u3002<\/li><li><code>close()<\/code> \uff1a\u5173\u95ed\u6b64\u6d41\uff0c\u4f46\u8981\u5148\u5237\u65b0\u5b83\u3002<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u7b26\u8f93\u51fa\u6d41<code>Writer<\/code>\u4e3b\u8981\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>write(char[] cbuf)<\/code> \uff1a\u5199\u5165\u5b57\u7b26\u6570\u7ec4\u3002<\/li><li><code>write(char[] cbuf, int off, int len)<\/code> \uff1a\u5199\u5165\u5b57\u7b26\u6570\u7ec4\u7684\u67d0\u4e00\u90e8\u5206\u3002<\/li><li><code>write(int c)<\/code> \uff1a\u5199\u5165\u5355\u4e2a\u5b57\u7b26\u3002<\/li><li><code>write(String str)<\/code> \uff1a\u5199\u5165\u5b57\u7b26\u4e32\u3002<\/li><li><code>write(String str, int off, int len)<\/code> \uff1a\u5199\u5165\u5b57\u7b26\u4e32\u7684\u67d0\u4e00\u90e8\u5206\u3002<\/li><li><code>flush()<\/code> \uff1a\u5237\u65b0\u8be5\u6d41\u7684\u7f13\u51b2\u3002<\/li><li><code>close()<\/code> \uff1a\u5173\u95ed\u6b64\u6d41\uff0c\u4f46\u8981\u5148\u5237\u65b0\u5b83\u3002<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u53e6\u5916\uff0c\u5b57\u7b26\u7f13\u51b2\u6d41\u8fd8\u6709\u4e24\u4e2a\u72ec\u7279\u7684\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>BufferedWriter<\/code>\u7c7b<code>newLine()<\/code> \uff1a<strong>\u300c\u5199\u5165\u4e00\u4e2a\u884c\u5206\u9694\u7b26\u3002\u8fd9\u4e2a\u65b9\u6cd5\u4f1a\u81ea\u52a8\u9002\u914d\u6240\u5728\u7cfb\u7edf\u7684\u884c\u5206\u9694\u7b26\u3002\u300d<\/strong><\/li><li><code>BufferedReader<\/code>\u7c7b<code>readLine()<\/code> \uff1a\u8bfb\u53d6\u4e00\u4e2a\u6587\u672c\u884c\u3002<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u9644\u52a0\u5185\u5bb9<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">\u4f4d\u3001\u5b57\u8282\u3001\u5b57\u7b26<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u8282(Byte)\u662f\u8ba1\u91cf\u5355\u4f4d\uff0c\u8868\u793a\u6570\u636e\u91cf\u591a\u5c11\uff0c\u662f\u8ba1\u7b97\u673a\u4fe1\u606f\u6280\u672f\u7528\u4e8e\u8ba1\u91cf\u5b58\u50a8\u5bb9\u91cf\u7684\u4e00\u79cd\u8ba1\u91cf\u5355\u4f4d\uff0c\u901a\u5e38\u60c5\u51b5\u4e0b\u4e00\u5b57\u8282\u7b49\u4e8e\u516b\u4f4d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u7b26(Character)\u8ba1\u7b97\u673a\u4e2d\u4f7f\u7528\u7684\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u5b57\u548c\u7b26\u53f7\uff0c\u6bd4\u5982\u2019A\u2019\u3001\u2018B\u2019\u3001\u2019$\u2019\u3001\u2019&amp;&#8217;\u7b49\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4e00\u822c\u5728\u82f1\u6587\u72b6\u6001\u4e0b\u4e00\u4e2a\u5b57\u6bcd\u6216\u5b57\u7b26\u5360\u7528\u4e00\u4e2a\u5b57\u8282\uff0c\u4e00\u4e2a\u6c49\u5b57\u7528\u4e24\u4e2a\u5b57\u8282\u8868\u793a\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b57\u8282\u4e0e\u5b57\u7b26\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>ASCII \u7801\u4e2d\uff0c\u4e00\u4e2a\u82f1\u6587\u5b57\u6bcd\uff08\u4e0d\u5206\u5927\u5c0f\u5199\uff09\u4e3a\u4e00\u4e2a\u5b57\u8282\uff0c\u4e00\u4e2a\u4e2d\u6587\u6c49\u5b57\u4e3a\u4e24\u4e2a\u5b57\u8282\u3002<\/li><li>UTF-8 \u7f16\u7801\u4e2d\uff0c\u4e00\u4e2a\u82f1\u6587\u5b57\u4e3a\u4e00\u4e2a\u5b57\u8282\uff0c\u4e00\u4e2a\u4e2d\u6587\u4e3a\u4e09\u4e2a\u5b57\u8282\u3002<\/li><li>Unicode \u7f16\u7801\u4e2d\uff0c\u4e00\u4e2a\u82f1\u6587\u4e3a\u4e00\u4e2a\u5b57\u8282\uff0c\u4e00\u4e2a\u4e2d\u6587\u4e3a\u4e24\u4e2a\u5b57\u8282\u3002<\/li><li>\u7b26\u53f7\uff1a\u82f1\u6587\u6807\u70b9\u4e3a\u4e00\u4e2a\u5b57\u8282\uff0c\u4e2d\u6587\u6807\u70b9\u4e3a\u4e24\u4e2a\u5b57\u8282\u3002\u4f8b\u5982\uff1a\u82f1\u6587\u53e5\u53f7 . \u53601\u4e2a\u5b57\u8282\u7684\u5927\u5c0f\uff0c\u4e2d\u6587\u53e5\u53f7 \u3002\u53602\u4e2a\u5b57\u8282\u7684\u5927\u5c0f\u3002<\/li><li>UTF-16 \u7f16\u7801\u4e2d\uff0c\u4e00\u4e2a\u82f1\u6587\u5b57\u6bcd\u5b57\u7b26\u6216\u4e00\u4e2a\u6c49\u5b57\u5b57\u7b26\u5b58\u50a8\u90fd\u9700\u8981 2 \u4e2a\u5b57\u8282\uff08Unicode \u6269\u5c55\u533a\u7684\u4e00\u4e9b\u6c49\u5b57\u5b58\u50a8\u9700\u8981 4 \u4e2a\u5b57\u8282\uff09\u3002<\/li><li>UTF-32 \u7f16\u7801\u4e2d\uff0c\u4e16\u754c\u4e0a\u4efb\u4f55\u5b57\u7b26\u7684\u5b58\u50a8\u90fd\u9700\u8981 4 \u4e2a\u5b57\u8282\u3002<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">IO\u6d41\u6548\u7387\u5bf9\u6bd4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u9996\u5148\uff0c\u5bf9\u6bd4\u4e0b\u666e\u901a\u5b57\u8282\u6d41\u548c\u7f13\u51b2\u5b57\u8282\u6d41\u7684\u6548\u7387\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class MyTest {\n\tpublic static void main(String[] args) throws IOException {\n\t\tFile file = new File(\"C:\/Mu\/test.txt\");\n\t\tStringBuilder sb = new StringBuilder();\n\n\t\tfor (int i = 0; i &lt; 3000000; i++) {\n\t\t\tsb.append(\"abcdefghigklmnopqrstuvwsyz\");\n\t\t}\n\t\tbyte[] bytes = sb.toString().getBytes();\n\n\t\tlong start = System.currentTimeMillis();\n\t\twrite(file, bytes);\n\t\tlong end = System.currentTimeMillis();\n\n\t\tlong start2 = System.currentTimeMillis();\n\t\tbufferedWrite(file, bytes);\n\t\tlong end2 = System.currentTimeMillis();\n\n\t\tSystem.out.println(\"\u666e\u901a\u5b57\u8282\u6d41\u8017\u65f6\uff1a\" + (end - start) + \" ms\");\n\t\tSystem.out.println(\"\u7f13\u51b2\u5b57\u8282\u6d41\u8017\u65f6\uff1a\" + (end2 - start2) + \" ms\");\n\n\t}\n\n\t\/\/ \u666e\u901a\u5b57\u8282\u6d41\n\tpublic static void write(File file, byte[] bytes) throws IOException {\n\t\tOutputStream os = new FileOutputStream(file);\n\t\tos.write(bytes);\n\t\tos.close();\n\t}\n\n\t\/\/ \u7f13\u51b2\u5b57\u8282\u6d41\n\tpublic static void bufferedWrite(File file, byte[] bytes) throws IOException {\n\t\tBufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream(file));\n\t\tbo.write(bytes);\n\t\tbo.close();\n\t}\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u666e\u901a\u5b57\u8282\u6d41\u8017\u65f6\uff1a250\u00a0ms\u7f13\u51b2\u5b57\u8282\u6d41\u8017\u65f6\uff1a268\u00a0ms<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u4e2a\u7ed3\u679c\u8ba9\u6211\u5927\u8dcc\u773c\u955c\uff0c\u4e0d\u662f\u8bf4\u597d\u7f13\u51b2\u6d41\u6548\u7387\u5f88\u9ad8\u4e48\uff1f\u8981\u77e5\u9053\u4e3a\u4ec0\u4e48\uff0c\u53ea\u80fd\u53bb\u6e90\u7801\u91cc\u627e\u7b54\u6848\u4e86\u3002\u7ffb\u770b\u5b57\u8282\u7f13\u51b2\u6d41\u7684<code>write<\/code>\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public synchronized void write(byte b[], int off, int len) throws IOException {\n    if (len &gt;= buf.length) {\n        \/* If the request length exceeds the size of the output buffer,\n           flush the output buffer and then write the data directly.\n           In this way buffered streams will cascade harmlessly. *\/\n        flushBuffer();\n        out.write(b, off, len);\n        return;\n    }\n    if (len &gt; buf.length - count) {\n        flushBuffer();\n    }\n    System.arraycopy(b, off, buf, count, len);\n    count += len;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6ce8\u91ca\u91cc\u8bf4\u5f97\u5f88\u660e\u767d\uff1a\u5982\u679c\u8bf7\u6c42\u957f\u5ea6\u8d85\u8fc7\u8f93\u51fa\u7f13\u51b2\u533a\u7684\u5927\u5c0f\uff0c\u5237\u65b0\u8f93\u51fa\u7f13\u51b2\u533a\uff0c\u7136\u540e\u76f4\u63a5\u5199\u5165\u6570\u636e\u3002\u8fd9\u6837\uff0c\u7f13\u51b2\u6d41\u5c06\u65e0\u5bb3\u5730\u7ea7\u8054\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f46\u662f\uff0c\u81f3\u4e8e\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u8bbe\u8ba1\uff0c\u6211\u6ca1\u6709\u60f3\u660e\u767d\uff0c\u6709\u54ea\u4f4d\u660e\u767d\u7684\u5927\u4f6c\u53ef\u4ee5\u7559\u8a00\u6307\u70b9\u4e00\u4e0b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u57fa\u4e8e\u4e0a\u9762\u7684\u60c5\u5f62\uff0c\u8981\u60f3\u5bf9\u6bd4\u666e\u901a\u5b57\u8282\u6d41\u548c\u7f13\u51b2\u5b57\u8282\u6d41\u7684\u6548\u7387\u5dee\u8ddd\uff0c\u5c31\u8981\u907f\u514d\u76f4\u63a5\u8bfb\u5199\u8f83\u957f\u7684\u5b57\u7b26\u4e32\uff0c\u4e8e\u662f\uff0c\u8bbe\u8ba1\u4e86\u4e0b\u9762\u8fd9\u4e2a\u5bf9\u6bd4\u6848\u4f8b\uff1a\u7528\u5b57\u8282\u6d41\u548c\u7f13\u51b2\u5b57\u8282\u6d41\u5206\u522b\u590d\u5236\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class MyTest {\n\tpublic static void main(String[] args) throws IOException {\n\t\tFile data = new File(\"C:\/Mu\/data.zip\");\n\t\tFile a = new File(\"C:\/Mu\/a.zip\");\n\t\tFile b = new File(\"C:\/Mu\/b.zip\");\n\n\t\tStringBuilder sb = new StringBuilder();\n\n\t\tlong start = System.currentTimeMillis();\n\t\tcopy(data, a);\n\t\tlong end = System.currentTimeMillis();\n\n\t\tlong start2 = System.currentTimeMillis();\n\t\tbufferedCopy(data, b);\n\t\tlong end2 = System.currentTimeMillis();\n\n\t\tSystem.out.println(\"\u666e\u901a\u5b57\u8282\u6d41\u8017\u65f6\uff1a\" + (end - start) + \" ms\");\n\t\tSystem.out.println(\"\u7f13\u51b2\u5b57\u8282\u6d41\u8017\u65f6\uff1a\" + (end2 - start2) + \" ms\");\n\t}\n\n\t\/\/ \u666e\u901a\u5b57\u8282\u6d41\n\tpublic static void copy(File in, File out) throws IOException {\n\t\t\/\/ \u5c01\u88c5\u6570\u636e\u6e90\n\t\tInputStream is = new FileInputStream(in);\n\t\t\/\/ \u5c01\u88c5\u76ee\u7684\u5730\n\t\tOutputStream os = new FileOutputStream(out);\n\t\t\n\t\tint by = 0;\n\t\twhile ((by = is.read()) != -1) {\n\t\t\tos.write(by);\n\t\t}\n\t\tis.close();\n\t\tos.close();\n\t}\n\n\t\/\/ \u7f13\u51b2\u5b57\u8282\u6d41\n\tpublic static void bufferedCopy(File in, File out) throws IOException {\n\t\t\/\/ \u5c01\u88c5\u6570\u636e\u6e90\n\t\tBufferedInputStream bi = new BufferedInputStream(new FileInputStream(in));\n\t\t\/\/ \u5c01\u88c5\u76ee\u7684\u5730\n\t\tBufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream(out));\n\t\t\n\t\tint by = 0;\n\t\twhile ((by = bi.read()) != -1) {\n\t\t\tbo.write(by);\n\t\t}\n\t\tbo.close();\n\t\tbi.close();\n\t}\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u666e\u901a\u5b57\u8282\u6d41\u8017\u65f6\uff1a184867\u00a0ms\u7f13\u51b2\u5b57\u8282\u6d41\u8017\u65f6\uff1a752\u00a0ms<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd9\u6b21\uff0c\u666e\u901a\u5b57\u8282\u6d41\u548c\u7f13\u51b2\u5b57\u8282\u6d41\u7684\u6548\u7387\u5dee\u5f02\u5c31\u5f88\u660e\u663e\u4e86\uff0c\u8fbe\u5230\u4e86245\u500d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u518d\u770b\u770b\u5b57\u7b26\u6d41\u548c\u7f13\u51b2\u5b57\u7b26\u6d41\u7684\u6548\u7387\u5bf9\u6bd4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class IOTest {\n\tpublic static void main(String[] args) throws IOException {\n\t\t\/\/ \u6570\u636e\u51c6\u5907\n\t\tdataReady();\n\n\t\tFile data = new File(\"C:\/Mu\/data.txt\");\n\t\tFile a = new File(\"C:\/Mu\/a.txt\");\n\t\tFile b = new File(\"C:\/Mu\/b.txt\");\n\t\tFile c = new File(\"C:\/Mu\/c.txt\");\n\n\t\tlong start = System.currentTimeMillis();\n\t\tcopy(data, a);\n\t\tlong end = System.currentTimeMillis();\n\n\t\tlong start2 = System.currentTimeMillis();\n\t\tcopyChars(data, b);\n\t\tlong end2 = System.currentTimeMillis();\n\n\t\tlong start3 = System.currentTimeMillis();\n\t\tbufferedCopy(data, c);\n\t\tlong end3 = System.currentTimeMillis();\n\n\t\tSystem.out.println(\"\u666e\u901a\u5b57\u8282\u6d411\u8017\u65f6\uff1a\" + (end - start) + \" ms,\u6587\u4ef6\u5927\u5c0f\uff1a\" + a.length() \/ 1024 + \" kb\");\n\t\tSystem.out.println(\"\u666e\u901a\u5b57\u8282\u6d412\u8017\u65f6\uff1a\" + (end2 - start2) + \" ms,\u6587\u4ef6\u5927\u5c0f\uff1a\" + b.length() \/ 1024 + \" kb\");\n\t\tSystem.out.println(\"\u7f13\u51b2\u5b57\u8282\u6d41\u8017\u65f6\uff1a\" + (end3 - start3) + \" ms,\u6587\u4ef6\u5927\u5c0f\uff1a\" + c.length() \/ 1024 + \" kb\");\n\t}\n\n\t\/\/ \u666e\u901a\u5b57\u7b26\u6d41\u4e0d\u4f7f\u7528\u6570\u7ec4\n\tpublic static void copy(File in, File out) throws IOException {\n\t\tReader reader = new FileReader(in);\n\t\tWriter writer = new FileWriter(out);\n\n\t\tint ch = 0;\n\t\twhile ((ch = reader.read()) != -1) {\n\t\t\twriter.write((char) ch);\n\t\t}\n\t\treader.close();\n\t\twriter.close();\n\t}\n\n\t\/\/ \u666e\u901a\u5b57\u7b26\u6d41\u4f7f\u7528\u5b57\u7b26\u6d41\n\tpublic static void copyChars(File in, File out) throws IOException {\n\t\tReader reader = new FileReader(in);\n\t\tWriter writer = new FileWriter(out);\n\n\t\tchar[] chs = new char[1024];\n\t\twhile ((reader.read(chs)) != -1) {\n\t\t\twriter.write(chs);\n\t\t}\n\t\treader.close();\n\t\twriter.close();\n\t}\n\n\t\/\/ \u7f13\u51b2\u5b57\u7b26\u6d41\n\tpublic static void bufferedCopy(File in, File out) throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(in));\n\t\tBufferedWriter bw = new BufferedWriter(new FileWriter(out));\n\n\t\tString line = null;\n\t\twhile ((line = br.readLine()) != null) {\n\t\t\tbw.write(line);\n\t\t\tbw.newLine();\n\t\t\tbw.flush();\n\t\t}\n\n\t\t\/\/ \u91ca\u653e\u8d44\u6e90\n\t\tbw.close();\n\t\tbr.close();\n\t}\n\n\t\/\/ \u6570\u636e\u51c6\u5907\n\tpublic static void dataReady() throws IOException {\n\t\tStringBuilder sb = new StringBuilder();\n\t\tfor (int i = 0; i &lt; 600000; i++) {\n\t\t\tsb.append(\"abcdefghijklmnopqrstuvwxyz\");\n\t\t}\n\t\tOutputStream os = new FileOutputStream(new File(\"C:\/Mu\/data.txt\"));\n\t\tos.write(sb.toString().getBytes());\n\n\t\tos.close();\n\t\tSystem.out.println(\"\u5b8c\u6bd5\");\n\t}\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u666e\u901a\u5b57\u7b26\u6d411\u8017\u65f6\uff1a1337\u00a0ms,\u6587\u4ef6\u5927\u5c0f\uff1a15234\u00a0kb\u666e\u901a\u5b57\u7b26\u6d412\u8017\u65f6\uff1a82\u00a0ms,\u6587\u4ef6\u5927\u5c0f\uff1a15235\u00a0kb\u7f13\u51b2\u5b57\u7b26\u6d41\u8017\u65f6\uff1a205\u00a0ms,\u6587\u4ef6\u5927\u5c0f\uff1a15234\u00a0kb<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u6d4b\u8bd5\u591a\u6b21\uff0c\u7ed3\u679c\u5dee\u4e0d\u591a\uff0c\u53ef\u89c1\u5b57\u7b26\u7f13\u51b2\u6d41\u6548\u7387\u4e0a\u5e76\u6ca1\u6709\u660e\u663e\u63d0\u9ad8\uff0c\u6211\u4eec\u66f4\u591a\u7684\u662f\u8981\u4f7f\u7528\u5b83\u7684<code>readLine()<\/code>\u548c<code>newLine()<\/code>\u65b9\u6cd5\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=5300\">Java\u5fc5\u4f1a\u7684IO\u5b57\u8282\u6d41\u3001\u5b57\u7b26\u6d41\u3001\u7f13\u51b2\u6d41\u77e5\u8bc6\u603b\u7ed3\uff01<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u6709\u4eba\u66fe\u95ee fastjson \u7684\u4f5c\u8005\uff08\u963f\u91cc\u6280\u672f\u4e13\u5bb6\u9ad8\u94c1\uff09\uff1a\u201c\u4f60\u5f00\u53d1fastjson\uff0c\u6ca1\u5f97\u5230\u4ec0\u4e48\u597d\u5904\uff0c\u53cd\u800c\u6328 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1169,899,252,1471,919],"class_list":["post-5300","post","type-post","status-publish","format-standard","hentry","category-java","tag-ioutils","tag-io","tag-nio","tag-optional","tag-spring-io-platform"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5300"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5300\/revisions"}],"predecessor-version":[{"id":5301,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/5300\/revisions\/5301"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}