The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

transfering zip files via URL and sockets

Posted by john on August 30, 2000 at 9:01 PM

I'm using sockets to transfer zip files (I use WinZip 8.0) to/from remote machine (remote and local are same in this case).

I use a zipInputStream to read in a ZipEntry object from a zip file, but when I write that same object to a zipOutputStream, I get a
java.util.zip.ZipException: invalid entry compressed size

For some reason, it's unable to write the correct compressed size to the zipOutputStream.
So, instead I create a new ZipEntry object with the same name and size, and put it on the zipOutputStream. But when the client reads from the socket's input stream, in our case, the zipInputStream, it cannot get the size of the zipEntry (zipEntry.getSize() = -1). Same thing happens when I read from a URL connection. This is a problem b/c if I read more or less class bytes, the target class will not be resolved by my custom class loader.
Why can't the zip entry size be determined when it's being read over a socket or URL connection - how can the size value be preserved ?

platform: windows NT 4.o
jdk1.2.2-006

thanks in advance,
john




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us