saveFile.getParentFile());
tempFile.deleteOnExit();
// Create a ZIP stream writing to the temporary file
FileOutputStream tempStream = new FileOutputStream(tempFile);
ZipOutputStream zipStream = new ZipOutputStream(tempStream);
// Stage 1 - save version and configuration
currentStage++;
saveVersion(zipStream);
saveConfiguration(zipStream);
if (isCanceled()) {
zipStream.close();
tempFile.delete();
return;
}
// Stage 2 - save RawDataFile objects
currentStage++;
saveRawDataFiles(zipStream);
if (isCanceled()) {
zipStream.close();
tempFile.delete();
return;
}
// Stage 3 - save PeakList objects
currentStage++;
savePeakLists(zipStream);
if (isCanceled()) {
zipStream.close();
tempFile.delete();
return;
}
// Stage 4 - save user parameters
currentStage++;
saveUserParameters(zipStream);
if (isCanceled()) {
zipStream.close();
tempFile.delete();
return;
}
// Stage 5 - finish and close the temporary ZIP file
currentStage++;
currentSavedObjectName = null;
zipStream.close();
// Final check for cancel
if (isCanceled()) {
tempFile.delete();
return;