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

Method ReadData

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

Source from the content-addressed store, hash-verified

597}
598
599func (s uint16ArraySerializer) ReadData(ctx *ReadContext, value reflect.Value) {
600 buf := ctx.Buffer()
601 err := ctx.Err()
602 size := ctx.ReadBinaryLength()
603 length, ok := checkWireArraySize(ctx, size, 2, value)
604 if !ok {
605 return
606 }
607 if length > 0 {
608 if isLittleEndian {
609 ptr := value.Addr().UnsafePointer()
610 buf.Read(unsafe.Slice((*byte)(ptr), size))
611 } else {
612 for i := 0; i < length; i++ {
613 value.Index(i).SetUint(uint64(uint16(buf.ReadInt16(err))))
614 }
615 }
616 }
617}
618
619func (s uint16ArraySerializer) Read(ctx *ReadContext, refMode RefMode, readType bool, hasGenerics bool, value reflect.Value) {
620 done := readArrayRefAndType(ctx, refMode, readType, value)

Callers 1

ReadMethod · 0.95

Calls 9

checkWireArraySizeFunction · 0.85
ReadBinaryLengthMethod · 0.80
SliceMethod · 0.80
ReadMethod · 0.65
uint64Function · 0.50
uint16Function · 0.50
BufferMethod · 0.45
ErrMethod · 0.45
ReadInt16Method · 0.45

Tested by

no test coverage detected