Write appends the contents of p to the buffer, growing the buffer as needed. The return value n is the length of p; err is always nil. If the buffer becomes too large, Write will panic with ErrTooLarge.
(p []byte)
| 174 | // needed. The return value n is the length of p; err is always nil. If the |
| 175 | // buffer becomes too large, Write will panic with ErrTooLarge. |
| 176 | func (b *Buffer) Write(p []byte) (n int, err error) { |
| 177 | if b.skipTrailingByte { |
| 178 | p = p[:len(p)-1] |
| 179 | } |
| 180 | m := b.grow(len(p)) |
| 181 | return copy(b.buf[m:], p), nil |
| 182 | } |
| 183 | |
| 184 | // WriteString appends the contents of s to the buffer, growing the buffer as |
| 185 | // needed. The return value n is the length of s; err is always nil. If the |