code: func (w *Writer) ReadFrom(src io.Reader) (n int64, err error) {
  	var nn int
  	for err == nil {
  		if w.Available() == 0 {
  			err = w.FlushFragment()
  			continue
  		}
  
  		// We copy the behavior of bufio.Writer here.
  		// Also, from the docs on io.ReaderFrom:
  		//   ReadFrom reads data from r until EOF or error.
  		//
  		// See https://codereview.appspot.com/76400048/#ps1
  		const maxEmptyReads = 100
  		var nr int
  		for nr < maxEmptyReads {
  			nn, err = src.Read(w.buf[w.n:])
  			if nn != 0 || err != nil {
  				break
  			}
  			nr++
  		}
  		if nr == maxEmptyReads {
  			return n, io.ErrNoProgress
  		}
  
  		w.n += nn
  		n += int64(nn)
  	}
  	if err == io.EOF {
  		// NOTE: Do not flush preemtively.
  		// See the Write() sources for more info.
  		err = nil
  		w.dirty = true
  	}
  	return n, err
  }
docs: // ReadFrom implements io.ReaderFrom.