code: func (s *framedDecoderStream) Read(p []byte) (n int, err error) {
  
  	if s.state == fdsHeader {
  		err = s.loadHeader()
  		if err != nil {
  			return 0, err
  		}
  	}
  
  	if s.state == fdsBody {
  		n, err = s.r.Read(p)
  		if err == ErrPunctuated {
  			err = nil
  			s.state = fdsFooter
  		}
  		if err == io.EOF {
  			err = io.ErrUnexpectedEOF
  		}
  		if err != nil {
  			return 0, err
  		}
  	}
  
  	if s.state == fdsFooter {
  		s.footer, err = s.r.ReadUntilPunctuation(s.frameLim)
  		if err != nil {
  			return 0, err
  		}
  		if s.frameChecker != nil {
  			headerStr, err := s.toASCII(s.header)
  			if err != nil {
  				return 0, err
  			}
  			footerStr, err := s.toASCII(s.footer)
  			if err != nil {
  				return 0, err
  			}
  			if _, err = s.frameChecker(headerStr, footerStr); err != nil {
  				return 0, err
  			}
  		}
  		s.state = fdsEndOfStream
  	}
  
  	if s.state == fdsEndOfStream {
  		err = s.consumeUntilEOF()
  		if err == io.EOF && n > 0 {
  			err = nil
  		}
  	}
  
  	return n, err
  }
docs: // Read from a framedDeecoderStream. The frame is the "BEGIN FOO." block
  // at the beginning, and the "END FOO." block at the end.