Add comments to explain why openAndTruncateStream()
This commit is contained in:
parent
c80c378398
commit
7e4cf82b9d
2 changed files with 5 additions and 0 deletions
|
|
@ -24,6 +24,8 @@ class ImportExportManager(private val fileLocator: BackupFileLocator) {
|
|||
*/
|
||||
@Throws(Exception::class)
|
||||
fun exportDatabase(preferences: SharedPreferences, file: StoredFileHelper) {
|
||||
// truncate the file before writing to it, otherwise if the new content is smaller than the
|
||||
// previous file size, the file will retain part of the previous content and be corrupted
|
||||
ZipOutputStream(SharpOutputStream(file.openAndTruncateStream()).buffered()).use { outZip ->
|
||||
// add the database
|
||||
ZipHelper.addFileToZip(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue