title: convert binary data to gzip file and decompress to a string c#
body: <p>I am trying to decode binary data that represents a gzip file, I need to decompress the gzip so I can get the nbt (minecraft notation thing) string that is in the gzip, but I keep getting the following error at GZipStream.Read:</p>
  <blockquote>
  <p>The archive entry was compressed using an unsupported compression method.</p>
  </blockquote>
  <p>Does anyone have any idea on how to do this?</p>
  <p>This is my code:</p>
  <pre><code>public static string Decompress(string input)
  {
      byte[] compressed = Convert.FromBase64String(input); //This is the binary data
      byte[] decompressed = Decompress(compressed);
      return Encoding.UTF8.GetString(decompressed);
  }
  
  private static byte[] Decompress(byte[] input)
  {
      using (var source = new MemoryStream(input))
      {
          byte[] lengthBytes = new byte[4];
          source.Read(lengthBytes, 0, 4);
  
          var length = BitConverter.ToInt32(lengthBytes, 0);
          using (var decompressionStream = new GZipStream(source,
              CompressionMode.Decompress))
          {
              var result = new byte[length];
              decompressionStream.Read(result, 0, length); //Error
              return result;
          }
      }
  }
  </code></pre>