title: gzinflate in Java
body: <p>So, my Java application reveives some data that is generated with PHP's gzdeflate().
  Now i'm trying to inflate that data with Java. This is what i've got so far:</p>
  
  <pre><code>InflaterInputStream inflInstream = new InflaterInputStream(new ByteArrayInputStream(inputData.getBytes() ), new Inflater());
  
  byte bytes[] = new byte[1024];
  while (true) {
      int length = inflInstream.read(bytes, 0, 1024);
      if (length == -1)  break;
  
      System.out.write(bytes, 0, length);
  }
  </code></pre>
  
  <p>'inputData' is a String containing the deflated data.</p>
  
  <p>The problem is: the .read method throws an exception:</p>
  
  <blockquote>
    <p>java.util.zip.ZipException: incorrect header check</p>
  </blockquote>
  
  <p>Other websites on this subject only go as far as redirecting me to the Inflater class' documentation, but apparently I don't know how to use it to be compatible with PHP.</p>