CheckReadable ensures that at least n bytes are available to read. In stream mode, it will attempt to fill the buffer if necessary.
(n int, err *Error)
| 1671 | // CheckReadable ensures that at least n bytes are available to read. |
| 1672 | // In stream mode, it will attempt to fill the buffer if necessary. |
| 1673 | func (b *ByteBuffer) CheckReadable(n int, err *Error) bool { |
| 1674 | if n < 0 { |
| 1675 | if err != nil { |
| 1676 | *err = DeserializationErrorf("negative readable byte count: %d", n) |
| 1677 | } |
| 1678 | return false |
| 1679 | } |
| 1680 | if n > len(b.data)-b.readerIndex { |
| 1681 | return b.fill(n, err) |
| 1682 | } |
| 1683 | return true |
| 1684 | } |
no test coverage detected