Multiple files compress and download

Hello everyone,

I would like to know how to download multiple files compress into zip file and download when download button is clicked.
I can download single file when user click on download button.
Can anyone share me how to download multiple files compress into zip file and download.

This is my code example.
downloadUI.getBtnDone().addListener(new Button.ClickListener() {

										@Override
										public void buttonClick(ClickEvent event) {
											Map<Integer, Document> map= downloadUI.getDocMap() != null ? downloadUI.getDocMap() : new HashMap<Integer, Document>();
											for ( Iterator<Integer> iter = map.keySet().iterator(); iter.hasNext();){
												Document doc = map.get(iter.next());

// logger.info("document file name : "+doc.getFile().getName());
getMainWindow().open(new ExternalResource(downloadUI.getDocumentUrl()));
}
(downloadUI.getWindow().getParent()).removeWindow(pOrD.getWindow());
}
});

Thanks and Regards,
Yan

As far as Vaadin goes, you could use:

com.vaadin.terminal.StreamResource instead of:

com.vaadin.terminal.ExternalResource and generate data on the fly using something like:

java.util.zip.ZipOutputStream

As a side note, when iterating over values in map you can use:

for (V value : map.values()) {
    // ...
}

Is there any example available to download zip file