func (c *codec) readBuffer(n int) ([]byte, error) {
	if n < c.r.Size() {
		buf, err := c.r.Peek(n)
		if err != nil {
			return nil, err
		}
		c.r.Discard(n)
		return buf, nil
	}
	buf := make([]byte, n)
	_, err := io.ReadFull(c.r, buf)
	return buf, err
}
// readBuffer read next n bytes from reader.
// if n less than the internal buffer size, then use Peek to get buffer,
// else make a new buffer, and copy data to the new buffer.
//
// user must not retain the returned buffer
readBuffer read next n bytes from reader.
if n less than the internal buffer size, then use Peek to get buffer,
else make a new buffer, and copy data to the new buffer.

user must not retain the returned buffer
// readBuffer read next n bytes from reader . // if n less than the internal buffer size then use Peek to get buffer // else make a new buffer and copy data to the new buffer . // // user must not retain the returned buffer
func (c *codec) readBuffer(n int) ([]byte, error) {
	if n < c.r.Size() {
		buf, err := c.r.Peek(n)
		if err != nil {
			return nil, err
		}
		c.r.Discard(n)
		return buf, nil
	}
	buf := make([]byte, n)
	_, err := io.ReadFull(c.r, buf)
	return buf, err
}
func ( c * codec ) readBuffer ( n int ) ( [ ] byte , error ) { if n < c . r . Size ( ) { buf , err := c . r . Peek ( n ) if err != nil { return nil , err } c . r . Discard ( n ) return buf , nil } buf := make ( [ ] byte , n ) _ , err := io . ReadFull ( c . r , buf ) return buf , err }
readBuffer read next n bytes from reader.
readBuffer read next n bytes from reader .