decode.go
func (d *StreamDecoder) Len() int {
	if d.err != nil {
		return 0
	}

	if d.typ == Unknown {
		if d.init() != nil {
			return 0
		}
	}

	return d.max - d.cnt
}
func (d *StreamDecoder) Len() int {
	if d.err != nil {
		return 0
	}

	if d.typ == Unknown {
		if d.init() != nil {
			return 0
		}
	}

	return d.max - d.cnt
}
// Len returns the number of values remaining to be read from the stream, which
// may be -1 if the underlying format doesn't provide this information. If an
// error occurred while decoding the stream the method returns zero because no
// more values can be read.