{"id":1657,"date":"2010-04-12T13:22:18","date_gmt":"2010-04-12T05:22:18","guid":{"rendered":"\/?p=1657"},"modified":"2010-04-12T13:22:18","modified_gmt":"2010-04-12T05:22:18","slug":"1657","status":"publish","type":"post","link":"https:\/\/www.justzz.com\/spec\/1657.html","title":{"rendered":"\u6587\u4ef6\u8bfb\u5199IO\u64cd\u4f5c"},"content":{"rendered":"<p><strong>i<\/strong>mport java.io.*;<br \/>\npublic class WriterReaderTest {<br \/>\npublic static void main(String[] args) {<br \/>\nFileInputStream fis=null;<br \/>\nInputStreamReader isr=null;<br \/>\nBufferedReader br=null;<br \/>\nFileOutputStream fos=null;<br \/>\nOutputStreamWriter osw=null;<br \/>\nBufferedWriter bw=null;<br \/>\ntry {<br \/>\nfos=new FileOutputStream(\"d:\\\\a.txt\");<br \/>\nosw=new OutputStreamWriter(fos,\"GBK\");<br \/>\nbw=new BufferedWriter(osw);<br \/>\nbw.write(\"haha,\u4f60\u597d\");<br \/>\nbw.flush();<br \/>\n} catch (IOException e) {<br \/>\ne.printStackTrace();<br \/>\n}finally{<br \/>\nif(bw!=null)try{bw.close();}catch(Exception e){}<br \/>\nif(osw!=null)try{osw.close();}catch(Exception e){}<br \/>\nif(fos!=null)try{fos.close();}catch(Exception e){}<br \/>\n}<br \/>\ntry {<br \/>\nfis=new FileInputStream(\"d:\\\\a.txt\");<br \/>\nisr=new InputStreamReader(fis,\"GBK\");<br \/>\nbr=new BufferedReader(isr);<br \/>\nString str=null;<br \/>\nwhile((str=br.readLine())!=null){<br \/>\nSystem.out.print(str);<br \/>\n}<br \/>\n} catch (IOException e) {<br \/>\ne.printStackTrace();<br \/>\n}finally{<br \/>\nif(br!=null)try{br.close();}catch(Exception e){}<br \/>\nif(isr!=null)try{isr.close();}catch(Exception e){}<br \/>\nif(fis!=null)try{fis.close();}catch(Exception e){}<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>import java.io.*; public class WriterReaderTest { public static void main(String[] args) { FileInputStream fis=null; InputStr&hellip;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-1657","post","type-post","status-publish","format-standard","hentry","category-t"],"_links":{"self":[{"href":"https:\/\/www.justzz.com\/spec\/wp-json\/wp\/v2\/posts\/1657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.justzz.com\/spec\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.justzz.com\/spec\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.justzz.com\/spec\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.justzz.com\/spec\/wp-json\/wp\/v2\/comments?post=1657"}],"version-history":[{"count":0,"href":"https:\/\/www.justzz.com\/spec\/wp-json\/wp\/v2\/posts\/1657\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.justzz.com\/spec\/wp-json\/wp\/v2\/media?parent=1657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.justzz.com\/spec\/wp-json\/wp\/v2\/categories?post=1657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.justzz.com\/spec\/wp-json\/wp\/v2\/tags?post=1657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}