ZipOutputStream "duplicate entry"

Hi all,

I have a program which downloads a bunch of documents from a remote server and after, bundles them up in a .zip file using ZipOutputStream.

The problem is that when I download the files, there could be more than one file with the same file name. So, when I try to put an entry with the same file name which is in already ZipOutputStream, it will throw an exception "duplicate entry".

Is there a way, I can check for duplicate entry, before adding the zip entry to ZipOutputStream? so I can rename the duplicate file?