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

Method ReadData

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

Source from the content-addressed store, hash-verified

202}
203
204func (s int16ArraySerializer) ReadData(ctx *ReadContext, value reflect.Value) {
205 buf := ctx.Buffer()
206 err := ctx.Err()
207 size := ctx.ReadBinaryLength()
208 length, ok := checkWireArraySize(ctx, size, 2, value)
209 if !ok {
210 return
211 }
212 if length > 0 {
213 if isLittleEndian {
214 ptr := value.Addr().UnsafePointer()
215 buf.Read(unsafe.Slice((*byte)(ptr), size))
216 } else {
217 for i := 0; i < length; i++ {
218 value.Index(i).SetInt(int64(buf.ReadInt16(err)))
219 }
220 }
221 }
222}
223
224func (s int16ArraySerializer) Read(ctx *ReadContext, refMode RefMode, readType bool, hasGenerics bool, value reflect.Value) {
225 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
ReadInt16Method · 0.45

Tested by

no test coverage detected