Closed Edouard127 closed 1 year ago
This pull request fixes issues with gzip/zlib writers, where the NBT is not written to the buffer until the writer is closed
Example:
func TestEncoder_EncodeNil(t *testing.T) { type Struct struct { Hi string } arg := Struct{ Hi: "A", } var buf bytes.Buffer writer := zlib.NewWriter(&buf) err := NewEncoder(writer).Encode(arg, "") if err != nil { t.Fatal(err) } writer.Close() // Removing this does not write to the buffer fmt.Println(buf.Bytes()) }
No, it's your responsibility to flush or close the writer.
For example, consider the case we are sending NBT through network, of course we can't close the connection every time we send a NBT message.
This pull request fixes issues with gzip/zlib writers, where the NBT is not written to the buffer until the writer is closed
Example: