Bytes returns a copy of the buffered content as a byte slice. The returned slice is safe to retain and modify.
()
| 31 | // Bytes returns a copy of the buffered content as a byte slice. |
| 32 | // The returned slice is safe to retain and modify. |
| 33 | func (b *Buffer) Bytes() []byte { |
| 34 | b.mu.Lock() |
| 35 | defer b.mu.Unlock() |
| 36 | return slices.Clone(b.buf.Bytes()) |
| 37 | } |
| 38 | |
| 39 | // Len returns the number of bytes currently buffered. |
| 40 | func (b *Buffer) Len() int { |