AtomicFile API level 17からファイルを安全に操作するための仕組みとしてAtomicFileが導入された。 これは書き込み開始時に元ファイルをバックアップし、失敗時にはロールバックすることでファイルの破損を防ぐ仕組みだ。 SupportLibraryにもr11から追加されているため、古い機種でも利用することができる。 http://developer.android.com/reference/android/support/v4/util/AtomicFile.html メソッド openRead ファイル読み込みのためのFileInputStreamを取得する 前回のバックアップファイルが残っている場合、不正終了とみなして自動的にロールバックする readFully openReadした内容をbyte[]で取得する startWrite ファイルの編集を行うためのF