title: How to decompress invocation API response In Java?
body: <p>I want to decompress an API response (header : <code>Accept-encoding=gzip</code>).</p>
  <p>Here are the lines I tried but always failed due to:</p>
  <blockquote>
  <p><code>java.util.zip.ZipException: Not in GZIP format</code></p>
  </blockquote>
  <pre class="lang-java prettyprint-override"><code>String entity = response.readEntity(String.class); 
  // When I print &quot;entity&quot; I will get Compress message as below:
  ��{o�ʒ��
  ���c^MC��������ut4&quot;�ms���fWGگ�_o?�V�G�ę�=�PF�3��i�������ɚ���G�[�eEA����$��M�(�rW�nk��97�m�r��6�$�$T�a^ZaIj�&quot;�5U�4�����4:oW�C{�-��A�c0�hސ�*l���JP�ƚ.������t�
  }ˏ�r�kIxjk��!���m�0��Z�9    ���r[�����6!٦^fQ�X_d)hބe���m��\RP�Y��Xg�:�F�IEE�5]U��f�\jϋ�?N�ߖ�&lt;�κ;�+��j�xQ�{����40�]4N�NOib�=o(r�mL�rLϱ�&gt;Rۖ�l4
  {2jʁk��f�*�љw��a�l���������^�V�a�ӱ���w[2�V&gt;n��'��n���;�ȧ�#�p-ch}&lt;&gt;�9&gt;�IB�~X��X���=��lz9)H��2#O?�R����*�����q�c�V�t����c�ܩ&lt;��A��[���4
  ��
  
  byte[] input = entity.getBytes(); 
  
  // helper method
  public static String decompress(byte[] compressed) throws IOException {
          ByteArrayInputStream bis = new ByteArrayInputStream(compressed);
          // Always failed at &quot;GZIPInputStream&quot; line due to java.util.zip.ZipException: Not in GZIP format        
          GZIPInputStream gis = new GZIPInputStream(bis); 
          BufferedReader br = new BufferedReader(new InputStreamReader(gis, &quot;UTF-8&quot;));
          StringBuilder sb = new StringBuilder();
          String line;
          while((line = br.readLine()) != null) {
              sb.append(line);
          }
          br.close();
          gis.close();
          bis.close();
          return sb.toString();
      }
  </code></pre>