From: dddddd d. <ur...@ho...> - 2004-05-12 17:37:29
|
I use version 0.06 I have found a solution to the problem but I had to change the way I read the entry. This is what I was doing: byte[] finalFile = null; try { ByteArrayInputStream bais = new ByteArrayInputStream(archivo); ZipInputStream zip = new ZipInputStream(bais); ZipEntry anEntry = zip.getNextEntry(); while (anEntry != null) { long decompressedSize = anEntry.getSize(); byte[] uncompressedBuf = new byte[(int)decompressedSize]; zip.read(uncompressedBuf); if (anEntry.getName().equalsIgnoreCase("FILE_NAME.txt")) { finalFile = uncompressedBuf; } anEntry = zip.getNextEntry(); } zip.closeEntry(); zip.close(); bais.close(); } catch (IOException e) { // stuff } And this is what I do now (instaed of zip.read(uncompressedBuf)): final int BUFFER = 2048; int count; byte data[] = new byte[BUFFER]; ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedOutputStream dest = new BufferedOutputStream(baos, BUFFER); while ((count = zis.read(data, 0, BUFFER)) != -1) { dest.write(data, 0, count); } dest.flush(); dest.close(); baos.close(); >Subject: Re: [Jazzlib-developers] Unfinished decompression >Date: Wed, 12 May 2004 15:28:31 +0200 > >Which version of jazzlib are you using? > >John Leuner > >On Wed, 2004-05-12 at 13:26, dddddd dddddd wrote: > > Could someone tell me why when decompresing a zip file I end up with a >file > > that has the first lines decompressed and readable but at some point the > > remainging of the file if filled with spaces. > > > > For example if the file should look like: > > > > 1234567890 > > 1234567890 > > 1234567890 > > 1234567890 > > 1234567890 > > > > I end up with : > > > > 1234567890 > > 1234 <-- empty spaces > > <-- empty spaces > > <-- empty spaces > > <-- empty spaces > > _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail |