Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to split a Zip file

 
pavi
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have ziped the files into a aa.zip file, If aa.zip file is bigger, for example, its size is bigger than 10MB, I want to split aa.zip into 5 files which is not bigger than 2MB . How do i need to do this?
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not aware of any public API that will help you do that.
(Although if you do not want to do it programatically, there are utilities like WinSplitter that will do it)

I have not tried it but, every ZipEntry while using ZippedInput/OutputStream has a compressed size. You may get a rough estimate of the size of the zipped file while creating it. If you need 2MB of zipped files, then you can stop writing to a file after the cumulative size of entries become 1.9MB, taking .1MB for Manifest file and other zip file specific elements.

So, in a nutshell, you can write a wrapper over the ZippedInputStream as follows:



The above program is just a hint of the approach and not a final solution by any means.
[ June 10, 2008: Message edited by: Nitesh Kant ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic