ReadByte reads and returns the next byte from the buffer. If no byte is available, it returns error io.EOF.
()
| 332 | // ReadByte reads and returns the next byte from the buffer. |
| 333 | // If no byte is available, it returns error io.EOF. |
| 334 | func (b *Buffer) ReadByte() (c byte, err error) { |
| 335 | if b.off >= len(b.buf) { |
| 336 | // Buffer is empty, reset to recover space. |
| 337 | b.Truncate(0) |
| 338 | return 0, io.EOF |
| 339 | } |
| 340 | c = b.buf[b.off] |
| 341 | b.off++ |
| 342 | return c, nil |
| 343 | } |
| 344 | |
| 345 | // ReadRune reads and returns the next UTF-8-encoded |
| 346 | // Unicode code point from the buffer. |
no test coverage detected