// Decode reads the next Protobuf-encoded message from its input and stores it
// in the value pointed to by m. If m isn't a proto.Message, Decode will panic.
Decode reads the next Protobuf-encoded message from its input and stores it
in the value pointed to by m. If m isn't a proto.Message, Decode will panic.
// Decode reads the next Protobuf - encoded message from its input and stores it // in the value pointed to by m . If m isn ' t a proto . Message Decode will panic .
func (d *Decoder) Decode(m interface{}) error {
	var (
		buf     = d.buf
		readlen = 0
	)
	for {
		eof, nr, err := d.r.ReadFrame(buf)
		if err != nil {
			return err
		}
		readlen += nr
		if readlen > MaxSize {
			return ErrSize
		}
		if eof {
			return d.uf(d.buf[:readlen], m.(proto.Message))
		}
		if len(buf) == nr {
			newbuf := make([]byte, readlen+4096)
			copy(newbuf, d.buf)
			d.buf = newbuf
			buf = d.buf[readlen:]
		} else {
			buf = buf[nr:]
		}
	}
}
func ( d * Decoder ) Decode ( m interface { } ) error { var ( buf = d . buf readlen = 0 ) for { eof , nr , err := d . r . ReadFrame ( buf ) if err != nil { return err } readlen += nr if readlen > MaxSize { return ErrSize } if eof { return d . uf ( d . buf [ : readlen ] , m . ( proto . Message ) ) } if len ( buf ) == nr { newbuf := make ( [ ] byte , readlen + 4096 ) copy ( newbuf , d . buf ) d . buf = newbuf buf = d . buf [ readlen : ] } else { buf = buf [ nr : ] } } }
Decode reads the next Protobuf-encoded message from its input and stores it
in the value pointed to by m. If m isn't a proto.Message, Decode will panic.
Decode reads the next Protobuf - encoded message from its input and stores it in the value pointed to by m . If m isn ' t a proto . Message Decode will panic .
// readlen and len(d.buf) are the same here