{"id":692,"date":"2019-03-18T01:19:13","date_gmt":"2019-03-17T17:19:13","guid":{"rendered":"http:\/\/www.eait.co\/?p=692"},"modified":"2019-03-18T01:19:13","modified_gmt":"2019-03-17T17:19:13","slug":"java%e5%ad%97%e7%ac%a6%e4%b8%b2%e5%86%99%e5%85%a5%e8%af%bb%e5%8f%96","status":"publish","type":"post","link":"https:\/\/notes.coremix.net\/?p=692","title":{"rendered":"java\u5b57\u7b26\u4e32\u5199\u5165\u8bfb\u53d6"},"content":{"rendered":"<pre>\/**\r\n * Created by xabcd on 2019\/3\/18.\r\n *\/\r\nimport java.io.*;\r\npublic class writeandreadfile {\r\n    public static void main(String args[]) {\r\n        File f = new File(\"c:\\\\xxx.txt\");\r\n        Writer out = null;\r\n        try {\r\n            out = new FileWriter(f);\r\n\r\n        } catch (IOException e) {\r\n            e.printStackTrace();\r\n        }\r\n        String s = new String(\"Hello World!!!\");\r\n        try {\r\n            out.write(s);\r\n        } catch (IOException e2) {\r\n            e2.printStackTrace();\r\n        }\r\n        try {\r\n            out.close();\r\n        } catch (IOException e9) {\r\n            e9.printStackTrace();\r\n        }\r\n\r\n\r\n        Reader in = null;\r\n        try {\r\n            in = new FileReader(f);\r\n\r\n        } catch (IOException e3) {\r\n            e3.printStackTrace();\r\n        }\r\n\/\/        String ss = new String ss[1024];\r\n        char c1[] = new char[1024];\r\n        int i = 0;\r\n        try {\r\n            i = in.read(c1);\r\n\/\/            in.close();\r\n        }\r\n        catch (IOException e4) {\r\n            e4.printStackTrace();\r\n        }\r\n\r\n        try {\r\n            in.close();\r\n        }\r\n        catch(IOException e8)\r\n        {\r\n            e8.printStackTrace();\r\n        }\r\n        System.out.println(new String(c1, 0, i));\r\n        System.out.println(i);\r\n\/\/        System.out.println(c1);\r\n\r\n    }\r\n}\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/** * Created by xabcd on 2019\/3\/18. *\/ import java.io. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-692","post","type-post","status-publish","format-standard","hentry","category-java"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=692"}],"version-history":[{"count":1,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/692\/revisions"}],"predecessor-version":[{"id":693,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=\/wp\/v2\/posts\/692\/revisions\/693"}],"wp:attachment":[{"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/notes.coremix.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}