8 Replies Latest reply on Apr 18, 2008 12:20 PM by 807591

    How to Check a stream is compressed or uncompressed

      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.