Is The Code I'm Using To Make .zip Files Correct?
I'm using this code in C# to zip files.. I need to open these files in an Android app (java): String mp3Files = 'E:\\'; int TrimLength = mp3Files.ToString().Length; byte[] obuffe
Solution 1:
Your problem might be due to FileInputStream object's mode. This link (has C# code) states the stream must be readable. Try changing your code according to their recommendation. Posting part of the code from their site:
using (var raw = File.Open(inputFileName, FileMode.Open, FileAccess.Read))
{
using (var input= new ZipInputStream(raw))
{
ZipEntry e;
while (( e = input.GetNextEntry()) != null)
{
Solution 2:
From the dicussion we've had on this question, the size of your entry is being set to 4294967295, which is the reason you're having a problem with the unzip in java. Try setting the Size:
FileInfofi=newFileInfo(Fil); // added this line here
oZipEntry = newZipEntry(Fil.Remove(0, TrimLength));
oZipEntry.Size = fi.Length; // added this line here
oZipStream.PutNextEntry(oZipEntry);
Apologies if the syntax is incorrect, this is untested.
Post a Comment for "Is The Code I'm Using To Make .zip Files Correct?"