ZipFile not thread safe


#1

Hi Jules,

 

It looks like ZipFile is not thread safe which means I cannot use multiple stream form the same ZipFile in different thread.

 

Is this normal ?

 

Thanks,


#2

Yeah, there's a single InputStream inside ZipFile that all the streams have to share. There's no easy way to change that because when you create a ZipFile, you supply the stream for it to use, and that could be any kind of class, not necessarily something that can be copied or used in parallel.

Simplest fix is just to create ZipFile objects for each of your threads.


#3

Yep that's what I have ended up doing.

 

Could be worth specifying in the documentation though :)

 

Thanks !


#4

True, I'll add a comment!