MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / ReadBytesNoCopy

Method ReadBytesNoCopy

utils/binary/reader.go:128–135  ·  view source on GitHub ↗

ReadBytesNoCopy 不拷贝读取的数据, 用于读取后立即使用, 慎用 如需使用, 请确保 Reader 未被回收

(length int)

Source from the content-addressed store, hash-verified

126//
127// 如需使用, 请确保 Reader 未被回收
128func (r *Reader) ReadBytesNoCopy(length int) (v []byte) {
129 if r.reader != nil {
130 return r.ReadBytes(length)
131 }
132 v = r.buffer[r.pos : r.pos+length]
133 r.pos += length
134 return
135}
136
137func (r *Reader) ReadBytes(length int) (v []byte) {
138 // 返回一个全新的数组罢

Callers 1

parseHighwayPacketFunction · 0.80

Calls 1

ReadBytesMethod · 0.95

Tested by

no test coverage detected