This project is read-only.

How to deal with zip file corruption from program crash

Aug 18, 2010 at 3:06 AM
Edited Aug 18, 2010 at 3:09 AM
If a program crashes where there are no exceptions to be caught (i.e. computer is turned off suddenly), the ZipOutputStream close/dispose method is not called and the resulting zip file is corrupt. Is there anyway to prevent corruption? Thanks.
Aug 20, 2010 at 11:52 AM
You'll need to adopt coding practices that handle such cases. For example, save to a temporary file and rename it to the final (permanent) filename only if the save completes successfully. Or, save in batches. Or, both. good luck.