discard discards the next n bytes from the reader.
(n int)
| 846 | |
| 847 | // discard discards the next n bytes from the reader. |
| 848 | func (d *Decoder) discard(n int) bool { |
| 849 | // Peek bytes we want to discard to count new lines. |
| 850 | if b, err := d.r.Peek(n); err == nil { |
| 851 | d.countNewLines(b) |
| 852 | } |
| 853 | |
| 854 | _, err := d.r.Discard(n) |
| 855 | if err != nil { |
| 856 | d.err = err |
| 857 | return false |
| 858 | } |
| 859 | return true |
| 860 | } |
| 861 | |
| 862 | // countNewLines counts the number of new lines in the given byte slice |
| 863 | // and increments the decoder's line counter accordingly. |
no test coverage detected