Pop returns the next n bytes with advancing the reader. The bytes stop being valid at the next read call. If Pop returns fewer than n bytes, it also returns an error explaining why the read is short. The error is ErrBufferFull if n is larger than b's buffer size.
(n int)
| 154 | // also returns an error explaining why the read is short. The error is |
| 155 | // ErrBufferFull if n is larger than b's buffer size. |
| 156 | func (b *Reader) Pop(n int) ([]byte, error) { |
| 157 | d, err := b.Peek(n) |
| 158 | if err == nil { |
| 159 | b.r += n |
| 160 | return d, err |
| 161 | } |
| 162 | return nil, err |
| 163 | } |
| 164 | |
| 165 | // Discard skips the next n bytes, returning the number of bytes discarded. |
| 166 | // |