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

Method Skip

go/fory/buffer.go:1647–1669  ·  view source on GitHub ↗

Skip skips n bytes and sets error on bounds violation

(length int, err *Error)

Source from the content-addressed store, hash-verified

1645
1646// Skip skips n bytes and sets error on bounds violation
1647func (b *ByteBuffer) Skip(length int, err *Error) {
1648 if length < 0 {
1649 if err != nil {
1650 *err = DeserializationErrorf("negative skip length: %d", length)
1651 }
1652 return
1653 }
1654 if length > len(b.data)-b.readerIndex {
1655 if b.reader == nil {
1656 if err != nil {
1657 *err = BufferOutOfBoundError(b.readerIndex, length, len(b.data))
1658 }
1659 return
1660 }
1661 available := len(b.data) - b.readerIndex
1662 b.readerIndex = len(b.data)
1663 if !b.discardFromReader(length-available, err) {
1664 return
1665 }
1666 return
1667 }
1668 b.readerIndex += length
1669}
1670
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.

Callers 5

skipSizedBytesFunction · 0.45
skipValueFunction · 0.45
skipTypeDefFunction · 0.45

Calls 3

discardFromReaderMethod · 0.95
DeserializationErrorfFunction · 0.85
BufferOutOfBoundErrorFunction · 0.85