- Androidプログラミング質問スレ revision50 [転載禁止]©2ch.net
54 :デフォルトの名無しさん[sage]:2015/11/30(月) 23:14:41.87 ID:69L+CIWv - 1〜2MBくらいのテキストhogeをファイルfooに書き出したいんだけど
FileOutputStream fileOutputStream = null; BufferedWriter bufferedWriter = null; fileOutputStream = new FileOutputStream( new File( foo ) ); bufferedWriter = new BufferedWriter( new OutputStreamWriter( fileOutputStream, "Shift_JIS") ); bufferedWriter.write( hoge ); 微妙に足りない形で完了してしまう・・・なぜかしら・・・
|
- Androidプログラミング質問スレ revision50 [転載禁止]©2ch.net
56 :デフォルトの名無しさん[sage]:2015/11/30(月) 23:43:29.72 ID:69L+CIWv - こんな感じ
try { fileOutputStream = new FileOutputStream( new File( foo ) ); bufferedWriter = new BufferedWriter( new OutputStreamWriter( fileOutputStream, "Shift_JIS") ); bufferedWriter.write( hoge ); } catch( IOException e ) { return false; } finally { try { fileOutputStream.close(); bufferedWriter.close(); } catch( IOException ioe ) { } }
|
- Androidプログラミング質問スレ revision50 [転載禁止]©2ch.net
57 :デフォルトの名無しさん[sage]:2015/11/30(月) 23:48:02.43 ID:69L+CIWv - logcatには何の例外もなく
十数文字だけ足りない時もあれば何十行も足りないケースもある
|