Slice returns a slice of length n to be used for writing.
(n int)
| 837 | |
| 838 | // Slice returns a slice of length n to be used for writing. |
| 839 | func (b *BytesBuffer) Slice(n int) []byte { |
| 840 | b.grow(n) |
| 841 | last := len(b.data) - 1 |
| 842 | b.off += n |
| 843 | b.sz += n |
| 844 | return b.data[last][b.off-n : b.off] |
| 845 | } |
| 846 | |
| 847 | // Length returns the size of the buffer. |
| 848 | func (b *BytesBuffer) Length() int { |