/** * Call when you have successfully finished writing to the stream * returned by {@link #startWrite()}. This will close, sync, and * commit the new data. The next attempt to read the atomic file * will return the new file stream. */ public void finishWrite(FileOutputStream str) { if (str != null) { sync(str); try { str.close(); mBackupName.delete(); } catch (IOException e) { Log.w("AtomicFile", "finishWrite: Got exception:", e); } } }
/** * Call when you have failed for some reason at writing to the stream * returned by {@link #startWrite()}. This will close the current * write stream, and roll back to the previous state of the file. */ public void failWrite(FileOutputStream str) { if (str != null) { sync(str); try { str.close(); mBaseName.delete(); mBackupName.renameTo(mBaseName); } catch (IOException e) { Log.w("AtomicFile", "failWrite: Got exception:", e); } } }
/** * Call when you have successfully finished writing to the stream * returned by {@link #startWrite()}. This will close, sync, and * commit the new data. The next attempt to read the atomic file * will return the new file stream. */ public void finishWrite(FileOutputStream str) { if (str != null) { sync(str); try { str.close(); mBackupName.delete(); } catch (IOException e) { Log.w("AtomicFile", "finishWrite: Got exception:", e); } } }
/** * Call when you have failed for some reason at writing to the stream * returned by {@link #startWrite()}. This will close the current * write stream, and roll back to the previous state of the file. */ public void failWrite(FileOutputStream str) { if (str != null) { sync(str); try { str.close(); mBaseName.delete(); mBackupName.renameTo(mBaseName); } catch (IOException e) { Log.w("AtomicFile", "failWrite: Got exception:", e); } } }
/** * Call when you have successfully finished writing to the stream * returned by {@link #startWrite()}. This will close, sync, and * commit the new data. The next attempt to read the atomic file * will return the new file stream. */ public void finishWrite(FileOutputStream str) { if (str != null) { sync(str); try { str.close(); mBackupName.delete(); } catch (IOException e) { Log.w("AtomicFile", "finishWrite: Got exception:", e); } } }
/** * Call when you have failed for some reason at writing to the stream * returned by {@link #startWrite()}. This will close the current * write stream, and roll back to the previous state of the file. */ public void failWrite(FileOutputStream str) { if (str != null) { sync(str); try { str.close(); mBaseName.delete(); mBackupName.renameTo(mBaseName); } catch (IOException e) { Log.w("AtomicFile", "failWrite: Got exception:", e); } } }