MCPcopy Create free account
hub / github.com/apache/fory / CheckReadable

Method CheckReadable

go/fory/buffer.go:1673–1684  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
1673func (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}

Callers 15

ReadDataMethod · 0.80
readDataMethod · 0.80
ReadDataMethod · 0.80
ReadDataMethod · 0.80
ReadByteSliceFunction · 0.80
ReadBoolSliceFunction · 0.80
ReadInt8SliceFunction · 0.80
ReadInt16SliceFunction · 0.80
ReadInt32SliceFunction · 0.80
ReadInt64SliceFunction · 0.80
ReadUint16SliceFunction · 0.80
ReadUint32SliceFunction · 0.80

Calls 2

fillMethod · 0.95
DeserializationErrorfFunction · 0.85

Tested by

no test coverage detected