Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I read a zip file over the network from a URL through a ZipInputStream?

0
Posted

How do I read a zip file over the network from a URL through a ZipInputStream?

0

Location: http://www.jguru.com/faq/view.jsp?EID=488756 Created: Sep 2, 2001 Author: Bogdan Sheptunov (http://www.jguru.com/guru/viewbio.jsp?EID=310126) Question originally posed by John Zukowski PREMIUM (http://www.jguru.com/guru/viewbio.jsp?EID=7 This piece uncompresses every entry of a ZIP file and puts them into a Vector. ZipEntry anEntry = null; Vector entriesList = new Vector(); try { URL aURL = new URL (“http://localhost/wwwroot.zip”); URLConnection aConnection = aURL.openConnection(); aConnection.setDoInput(true); aConnection.setDoOutput(false); aConnection.setUseCaches (false); aConnection.setDefaultUseCaches (false); aConnection.connect(); ZipInputStream inputStream = new ZipInputStream(aConnection.getInputStream()); anEntry = inputStream.getNextEntry(); while (anEntry != null) { long decompressedSize = anEntry.getSize(); byte[] uncompressedBuf = new byte[(int)decompressedSize]; inputStream.read(uncompressedBuf); entriesList.add(uncompressedBuf); anEntry = inputStream.getNextE

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123