public void readHeader() throws IOException {

    byte[] empty = "".getBytes();
    inflater.setInput(empty, 0, 0, false);
    inflater.setOutput(empty, 0, 0);

    int err = inflater.inflate(JZlib.Z_NO_FLUSH);
    if(!inflater.istate.inParsingHeader()){
      return;
    }

    byte[] b1 = new byte[1];
    do{
      int i = in.read(b1);
      if(i<=0)
        throw new IOException("no input");
      inflater.setInput(b1);
      err = inflater.inflate(JZlib.Z_NO_FLUSH);
      if(err!=0/*Z_OK*/)
        throw new IOException(inflater.msg);
    }
    while(inflater.istate.inParsingHeader());
  }