(a []byte)
| 154 | *b = append(*b, a...) |
| 155 | } |
| 156 | func (b *Buffer) Write(a []byte) (n int, err error) { |
| 157 | l := b.Len() |
| 158 | newL := l + len(a) |
| 159 | if newL > b.Cap() { |
| 160 | *b = append(*b, a...) |
| 161 | } else { |
| 162 | *b = b.SubBuf(0, newL) |
| 163 | copy((*b)[l:], a) |
| 164 | } |
| 165 | return len(a), nil |
| 166 | } |
| 167 | |
| 168 | func (b Buffer) Clone() (result Buffer) { |
| 169 | return append(result, b...) |