NewFrameReader returns a FrameReader that reads from r.
(r io.Reader)
| 42 | |
| 43 | // NewFrameReader returns a FrameReader that reads from r. |
| 44 | func NewFrameReader(r io.Reader) *FrameReader { |
| 45 | scanner := bufio.NewScanner(r) |
| 46 | scanner.Buffer(make([]byte, 0, 4096), maxLineSize) |
| 47 | scanner.Split(newLineSplitter()) |
| 48 | return &FrameReader{scanner: scanner} |
| 49 | } |
| 50 | |
| 51 | // Next blocks until a complete frame is read and returns it. It returns io.EOF when the stream ends; a frame that |
| 52 | // is not terminated by a blank line before the end is discarded. |