Skip to content

Commit

Permalink
feat: builder增加获取buffer方法
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Jun 28, 2024
1 parent 7e95929 commit 21b1ba6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions utils/binary/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func (b *Builder) ToReader() io.Reader {
return &b.buffer
}

// Buffer GC 不安全, 确保在 Builder 被回收前使用
func (b *Builder) Buffer() *bytes.Buffer {
return &b.buffer
}

// ToBytes return data with tea encryption if key is set
//
// GC 安全, 返回的数据在 Builder 被销毁之后仍能被正确读取,
Expand Down

0 comments on commit 21b1ba6

Please sign in to comment.