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

Method SkipBytesWithLength

utils/binary/reader.go:153–175  ·  view source on GitHub ↗
(prefix string, withPerfix bool)

Source from the content-addressed store, hash-verified

151}
152
153func (r *Reader) SkipBytesWithLength(prefix string, withPerfix bool) {
154 var length int
155 switch prefix {
156 case "u8":
157 length = int(r.ReadU8())
158 case "u16":
159 length = int(r.ReadU16())
160 case "u32":
161 length = int(r.ReadU32())
162 case "u64":
163 length = int(r.ReadU64())
164 default:
165 panic("invaild prefix")
166 }
167 if withPerfix {
168 plus, err := strconv.Atoi(prefix[1:])
169 if err != nil {
170 panic(err)
171 }
172 length -= plus / 8
173 }
174 r.SkipBytes(length)
175}
176
177func (r *Reader) ReadBytesWithLength(prefix string, withPerfix bool) []byte {
178 var length int

Callers 1

readSSOFrameMethod · 0.95

Calls 5

ReadU8Method · 0.95
ReadU16Method · 0.95
ReadU32Method · 0.95
ReadU64Method · 0.95
SkipBytesMethod · 0.95

Tested by

no test coverage detected