{"id":6243,"date":"2018-03-06T21:00:44","date_gmt":"2018-03-06T12:00:44","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=6243"},"modified":"2018-03-06T23:40:07","modified_gmt":"2018-03-06T14:40:07","slug":"%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e6%9b%b8%e3%81%8d%e8%be%bc%e3%81%bf%e5%be%8c%e3%81%aeclose%e5%87%a6%e7%90%86%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/6243","title":{"rendered":"\u30c6\u30ad\u30b9\u30c8\u66f8\u304d\u8fbc\u307f\u5f8c\u306eClose\u51e6\u7406\u306b\u3064\u3044\u3066"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306fTamamo\u3067\u3059\u3002<\/p>\n<p>\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u66f8\u304d\u8fbc\u3093\u3060\u5f8c\u306fFile\u95a2\u9023\u306e\u547d\u4ee4\u306fclose\u3059\u308b\u306e\u304c\u57fa\u672c\u3060\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n \u3057\u304b\u3057\u3001\u30cd\u30c3\u30c8\u306e\u60c5\u5831\u3092\u898b\u3066\u3044\u308b\u3068close\u3055\u308c\u3066\u3044\u306a\u3044\u30b3\u30fc\u30c9\u304c\u6563\u898b\u3055\u308c\u307e\u3059\u3002<br \/>\n \u6050\u3089\u304f\u3067\u3059\u304c\u3001\u3044\u3064\u304b\u306fGC\u3055\u308c\u308b\u304b\u3089\u3068\u304b\u3001\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3060\u304b\u3089\u826f\u3044\u304b\u3001<br \/>\n \u3068\u3044\u3046\u8003\u3048\u3067\u66f8\u304b\u308c\u3066\u3044\u306a\u3044\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u3057\u304b\u3057\u3001\u79c1\u306f\u66f8\u304d\u8fbc\u3093\u3060\u5f8c\u306f\u5fc5\u305aFile\u95a2\u9023\u306fclose\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n \u305f\u3060\u3001close\u3092\u8a18\u8ff0\u3059\u308b\u5834\u6240\u3092\u9593\u9055\u3048\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u73fe\u8c61\u304c\u6642\u3005\u3067\u3059\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<p>public void fileWrite(String str) {<\/p>\n<p>\u00a0 \u00a0 String filePath = Environment.getExternalStorageDirectory() + &#8220;\/&#8221; + &#8220;sample.txt&#8221;<br \/>\n \u00a0 \u00a0 File file = new File(filePath);<\/p>\n<p>\u00a0 \u00a0 try{<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/\u51fa\u529b\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u751f\u6210(\u8ffd\u8a18\u30e2\u30fc\u30c9)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 FileOutputStream fileOutputStream = new FileOutputStream(file, true);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/\u51fa\u529b\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u30d0\u30c3\u30d5\u30a1\u30ea\u30f3\u30b0<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 BufferedWriter bw = new BufferedWriter(outputStreamWriter);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u30d0\u30c3\u30d5\u30a1\u306b\u683c\u7d0d<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 bw.write(str);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/\u30d0\u30c3\u30d5\u30a1\u306e\u30c7\u30fc\u30bf\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 bw.flush();<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/close\u51e6\u7406<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 fileOutputStream.close();<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 outputStreamWriter.close();<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 bw.close();<br \/>\n \u00a0 \u00a0 \u00a0} catch (Exception e) {<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 e.printStackTrace();<br \/>\n \u00a0 \u00a0 \u00a0}<br \/>\n }<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td>sample.txt(\u51fa\u529b\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb)<br \/>\n 1,\u3042\u3044\u3046\u3048\u304a<br \/>\n 2,\u304b\u304d\u304f\u3051\u3053<br \/>\n 3,\u3055\u3057\u3059\u305b\u305d<br \/>\n 3,\u3055\u3057\u3059\u305b\u305d<br \/>\n 4,\u305f\u3061\u3064\u3066\u3068<br \/>\n \uff1a<br \/>\n \uff1a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>1\u79d2\u3054\u3068\u306b\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u8ffd\u8a18\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3060\u3063\u305f\u306e\u3067\u3059\u304c\u3001<br \/>\n \u3053\u306e\u4f8b\u3067\u306f3\u304c\u91cd\u8907\u3057\u3066\u51fa\u529b\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002\u305f\u3060\u3001\u91cd\u8907\u3057\u306a\u3044\u6642\u3082\u3042\u308a\u307e\u3059\u3002<br \/>\n \u6050\u3089\u304f\u3067\u3059\u304c\u3001\u66f8\u304d\u8fbc\u307f\u51e6\u7406(close\u542b\u3080)\u304c\u9593\u306b\u5408\u308f\u305a\u306b\u4f55\u3089\u304b\u306e\u539f\u56e0\u3067<br \/>\n \u30d0\u30c3\u30d5\u30a1\u306b\u305f\u307e\u3063\u305f\u60c5\u5831\u304c\u9023\u7d9a\u3067\u66f8\u304d\u8fbc\u307e\u308c\u3066\u3057\u307e\u3063\u305f\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u2460\u306e\u3088\u3046\u306bclose\u51e6\u7406\u3092finally\u306b\u66f8\u304f\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<p>public void fileWrite(String str) {<\/p>\n<p>\u00a0 \u00a0 String filePath = Environment.getExternalStorageDirectory() + &#8220;\/&#8221; + &#8220;sample.txt&#8221;<br \/>\n \u00a0 \u00a0 File file = new File(filePath);<\/p>\n<p>\u00a0 \u00a0 try{<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/\u51fa\u529b\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u751f\u6210(\u8ffd\u8a18\u30e2\u30fc\u30c9)<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 FileOutputStream fileOutputStream = new FileOutputStream(file, true);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/\u51fa\u529b\u30b9\u30c8\u30ea\u30fc\u30e0\u306e\u30d0\u30c3\u30d5\u30a1\u30ea\u30f3\u30b0<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 BufferedWriter bw = new BufferedWriter(outputStreamWriter);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u30d0\u30c3\u30d5\u30a1\u306b\u683c\u7d0d<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 bw.write(str);<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \/\/\u30d0\u30c3\u30d5\u30a1\u306e\u30c7\u30fc\u30bf\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 bw.flush();<br \/>\n \u00a0 \u00a0 \u00a0} catch (Exception e) {<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 e.printStackTrace();<br \/>\n \u00a0 \u00a0 \u00a0}<span style=\"font-family: inherit;font-size: inherit\">finally {\/\/\u2460<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 fileOutputStream.close();<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 outputStreamWriter.close();<br \/>\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 bw.close();<br \/>\n \u00a0 \u00a0 }<br \/>\n }<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u3059\u308b\u3068\u3001\u91cd\u8907\u3059\u308b\u3088\u3046\u306a\u73fe\u8c61\u306f\u4e00\u5207\u767a\u751f\u3057\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<td>sample.txt(\u51fa\u529b\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb)<br \/>\n 1,\u3042\u3044\u3046\u3048\u304a<br \/>\n 2,\u304b\u304d\u304f\u3051\u3053<br \/>\n 3,\u3055\u3057\u3059\u305b\u305d<br \/>\n 4,\u305f\u3061\u3064\u3066\u3068<br \/>\n \uff1a<br \/>\n \uff1a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>finally\u306f\u4f8b\u5916\u304c\u767a\u751f\u3059\u308b\u3057\u306a\u3044\u306b\u95a2\u308f\u3089\u305a\u5fc5\u305a\u5b9f\u884c\u3059\u308b\u306e\u3067\u3001<br \/>\n close\u304c\u9069\u5207\u306b\u51e6\u7406\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u306e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<br \/>\n finally\u306e\u5927\u5207\u3055\u3092\u611f\u3058\u307e\u3057\u305f\u3002<br \/>\n \u3053\u308c\u306f\u4eca\u5f8c\u306e\u30ce\u30a6\u30cf\u30a6\u3068\u3057\u3066\u5f79\u306b\u7acb\u3061\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u706b\u66dc\u65e5\u62c5\u5f53\uff1aTamamo<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/6243\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/6243\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"\u30c6\u30ad\u30b9\u30c8\u66f8\u304d\u8fbc\u307f\u5f8c\u306eClose\u51e6\u7406\u306b\u3064\u3044\u3066\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/6243\" data-text=\"\u30c6\u30ad\u30b9\u30c8\u66f8\u304d\u8fbc\u307f\u5f8c\u306eClose\u51e6\u7406\u306b\u3064\u3044\u3066\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/6243\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/6243\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306fTamamo\u3067\u3059\u3002 \u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u66f8\u304d\u8fbc\u3093\u3060\u5f8c\u306fFile\u95a2\u9023\u306e\u547d\u4ee4\u306fclose\u3059\u308b\u306e\u304c\u57fa\u672c\u3060\u3068\u601d\u3044\u307e\u3059\u3002 \u3057\u304b\u3057\u3001\u30cd\u30c3\u30c8\u306e\u60c5\u5831\u3092\u898b\u3066\u3044\u308b\u3068close\u3055\u308c\u3066\u3044\u306a\u3044\u30b3\u30fc\u30c9\u304c\u6563\u898b\u3055\u308c\u307e\u3059\u3002 \u6050\u3089\u304f\u3067\u3059 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[100,12],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/6243"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=6243"}],"version-history":[{"count":3,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/6243\/revisions"}],"predecessor-version":[{"id":6247,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/6243\/revisions\/6247"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=6243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=6243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=6243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}