Reading specific number of bytes from a buffered reader in golang
问题 I am aware of the specific function in golang from the bufio package. func (b *Reader) Peek(n int) ([]byte, error) Peek returns the next n bytes without advancing the reader . The bytes stop being valid at the next read call. If Peek 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. I need to be able to read a specific number of bytes from a Reader that will advance the reader . Basically,