8 Replies Latest reply: Apr 18, 2008 7:20 AM by 807591 RSS

    How to Check a stream is compressed or uncompressed

    807591
      Dear Experts,

      I writing a program where I need check incoming stream is compressed or not(zipstream or normal stream).


      For this i am using the following sample code.

      ZipInputStream zis = new ZipInputStream(inputstream);
      ZipEntry entry = null;
      ZipOutputStream zos = new ZipOutputStream(outputstream);

      if((entry = zis.getNextEntry()) != null){/just bypass the stream to outputstream}
      else{/do zipping and write it to the o/p stream}

      However if use the above logic and the incoming stream is not zip stream I am loosing some bytes of data in else logic while writing it to O/P stream.

      Is there any other work around for this requirement.



      Thanks
      Gujjeti