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

Method ReadData

go/fory/array_primitive.go:271–289  ·  view source on GitHub ↗
(ctx *ReadContext, value reflect.Value)

Source from the content-addressed store, hash-verified

269}
270
271func (s int32ArraySerializer) ReadData(ctx *ReadContext, value reflect.Value) {
272 buf := ctx.Buffer()
273 err := ctx.Err()
274 size := ctx.ReadBinaryLength()
275 length, ok := checkWireArraySize(ctx, size, 4, value)
276 if !ok {
277 return
278 }
279 if length > 0 {
280 if isLittleEndian {
281 ptr := value.Addr().UnsafePointer()
282 buf.Read(unsafe.Slice((*byte)(ptr), size))
283 } else {
284 for i := 0; i < length; i++ {
285 value.Index(i).SetInt(int64(buf.ReadInt32(err)))
286 }
287 }
288 }
289}
290
291func (s int32ArraySerializer) Read(ctx *ReadContext, refMode RefMode, readType bool, hasGenerics bool, value reflect.Value) {
292 done := readArrayRefAndType(ctx, refMode, readType, value)

Callers 1

ReadMethod · 0.95

Calls 8

checkWireArraySizeFunction · 0.85
ReadBinaryLengthMethod · 0.80
SliceMethod · 0.80
ReadMethod · 0.65
int64Function · 0.50
BufferMethod · 0.45
ErrMethod · 0.45
ReadInt32Method · 0.45

Tested by

no test coverage detected