How do I read a zip file over the network from a URL through a ZipInputStream?
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