Skip to content

Instantly share code, notes, and snippets.

@mmalmeida
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save mmalmeida/6c894f5237d7af060559 to your computer and use it in GitHub Desktop.

Select an option

Save mmalmeida/6c894f5237d7af060559 to your computer and use it in GitHub Desktop.
protected ZipOutputStream createZipFile(File file, List<DataCollectionItf> answers)
throws ExportException {
ZipOutputStream zipFile;
try {
zipFile = newZipFile(file);
} catch (FileNotFoundException e1) {
throw new ExportException("Zip file could not be initialised",e1);
}
List<String> filesAdded = new ArrayList<String>();
for (DataCollectionItf answer : answers) {
if(answer.getFreeText() != null && !answer.getFreeText().isEmpty()){
zipFile - create entry (...)
zipFile.closeEntry();
} catch (IOException e) {
throw new ExportException(...);
}
}
}
try {
zipFile.close();
} catch (IOException e) {
throw new ExportException("Error closing the Zip file",e);
}
return zipFile;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment