code: func (d *YAMLDecoder) Read(data []byte) (n int, err error) {
  	left := len(d.remaining)
  	if left == 0 {
  		// return the next chunk from the stream
  		if !d.scanner.Scan() {
  			err := d.scanner.Err()
  			if err == nil {
  				err = io.EOF
  			}
  			return 0, err
  		}
  		out := d.scanner.Bytes()
  		d.remaining = out
  		left = len(out)
  	}
  
  	// fits within data
  	if left <= len(data) {
  		copy(data, d.remaining)
  		d.remaining = nil
  		return left, nil
  	}
  
  	// caller will need to reread
  	copy(data, d.remaining[:len(data)])
  	d.remaining = d.remaining[len(data):]
  	return len(data), io.ErrShortBuffer
  }
docs: // Read reads the previous slice into the buffer, or attempts to read
  // the next chunk.
  // TODO: switch to readline approach.