Por que o gzip do Java e Go obtém resultados diferentes?

Primeiramente, minha versão do Java:

string str = "helloworld";
ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream(str.length());
GZIPOutputStream localGZIPOutputStream = new GZIPOutputStream(localByteArrayOutputStream);
localGZIPOutputStream.write(str.getBytes("UTF-8"));
localGZIPOutputStream.close();
localByteArrayOutputStream.close();
for(int i = 0;i < localByteArrayOutputStream.toByteArray().length;i ++){
    System.out.println(localByteArrayOutputStream.toByteArray()[i]);
}

e saída é:

31 -117 8 0 0 0 0 0 0 -53 72 -51 -55 -55 47 -49 47 -54 73 1 0 -83 32 -21 -7 10 0 0 0

Então a versão Go:

var gzBf bytes.Buffer
gzSizeBf := bufio.NewWriterSize(&gzBf, len(str))
gz := gzip.NewWriter(gzSizeBf)
gz.Write([]byte(str))
gz.Flush()
gz.Close()
gzSizeBf.Flush()
GB := (&gzBf).Bytes()
for i := 0; i < len(GB); i++ {
    fmt.Println(GB[i])
}

resultado:

31 139 8 0 0 9 110 136 0 255 202 72 205 201 201 47 207 47 202 73 1 0 0 0 255 255 1 0 0 255 255 173 32 235 249 10 0 0 0

Por quê?

Eu pensei que poderia ser causado por diferentes métodos de leitura de bytes desses dois idiomas no início. Mas notei que 0 nunca pode ser convertido em 9. E os tamanhos de[]byte são diferentes.

Escrevi código errado? Existe alguma maneira de fazer meu programa Go obter a mesma saída que o programa Java?

Obrigado!

questionAnswers(2)

yourAnswerToTheQuestion