title: Not a gzip format for a obvious gzip text in Java
body: <p>I have been trying to implement decompressing text compressed in GZIP format
  Below we have method I implemented</p>
  <pre><code>private byte[] decompress(String compressed) throws Exception {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      ByteArrayInputStream in = new 
          ByteArrayInputStream(compressed.getBytes(StandardCharsets.UTF_8));
      GZIPInputStream ungzip = new GZIPInputStream(in);
      byte[] buffer = new byte[256];
      int n;
      while ((n = ungzip.read(buffer)) &gt;= 0) {
          out.write(buffer, 0, n);
      }
      return out.toByteArray();
  }
  </code></pre>
  <p>And now I am testing the solution for following compressed text:</p>
  <pre><code>H4sIAAAAAAAACjM0MjYxBQAcOvXLBQAAAA==
  </code></pre>
  <p>And there is Not a gzip format exception.
  I tried different ways but there still is this error. Maybe anyone has idea what am I doing wrong?</p>