Problem in creating zip file on weblogic server
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
When i run following code on a tomcat server on local machine it rus fine & gives a correct zip file but when I run this on weblogic server then it gives error as
error:[c:\Documents & settings\mt1\local settings\temporary internet files\myzipfile[1].zip]": start of central directory not found. Zip file corrupt.
Possible error: Zip file error
Can anybody please help me in this?
error:[c:\Documents & settings\mt1\local settings\temporary internet files\myzipfile[1].zip]": start of central directory not found. Zip file corrupt.
Possible error: Zip file error
Can anybody please help me in this?
posted 14 years ago
That will probably already solve your problem. When read(byte[]) returns 0 that doesn't mean all data is read. It means there's currently no data available. -1 is the only value that indicates that you're done reading.
Also, you can remove this line:
reader.read(buffer) will re-fill the existing array. It's possible (likely even) that one or more reads do not overwrite all old data, but you know that all values from 0 to bytesRead (exclusive) are filled with new data, and this is exactly the portion you then write. In other words, all you're doing is create another array where no new array is necessary.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
That will probably already solve your problem. When read(byte[]) returns 0 that doesn't mean all data is read. It means there's currently no data available. -1 is the only value that indicates that you're done reading.
Also, you can remove this line:
reader.read(buffer) will re-fill the existing array. It's possible (likely even) that one or more reads do not overwrite all old data, but you know that all values from 0 to bytesRead (exclusive) are filled with new data, and this is exactly the portion you then write. In other words, all you're doing is create another array where no new array is necessary.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Tushar Mundada
Greenhorn
Posts: 9
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I did above changes. its still not working. It seems there is problem with the header of the zip file. Can anybody help to resolve exactly?
posted 14 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
If this is a JSP, make sure that absolutely no output is sent to the response before you use your code. That includes line breaks outside of JSP directives / tags. Even enters between your import directives will already be sent to the response.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
| Pay attention! Tiny ad! The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |












