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

Method ReadData

go/fory/slice_primitive_list.go:163–195  ·  view source on GitHub ↗
(ctx *ReadContext, value reflect.Value)

Source from the content-addressed store, hash-verified

161}
162
163func (s primitiveListSerializer) ReadData(ctx *ReadContext, value reflect.Value) {
164 buf := ctx.Buffer()
165 err := ctx.Err()
166 length := ctx.ReadCollectionLength()
167 if ctx.HasError() {
168 return
169 }
170 if length == 0 {
171 value.Set(reflect.MakeSlice(value.Type(), 0, 0))
172 return
173 }
174 collectFlag := buf.ReadInt8(err)
175 if ctx.HasError() {
176 return
177 }
178 if (collectFlag & CollectionIsSameType) != 0 {
179 if (collectFlag & CollectionIsDeclElementType) == 0 {
180 ctx.TypeResolver().ReadTypeInfo(buf, err)
181 }
182 }
183 if ctx.HasError() {
184 return
185 }
186 if (collectFlag & CollectionTrackingRef) != 0 {
187 ctx.SetError(DeserializationErrorf("primitive list does not support reference-tracked elements"))
188 return
189 }
190 hasNull := (collectFlag & CollectionHasNull) != 0
191 if !s.checkBodyReadable(buf, err, length, hasNull) {
192 return
193 }
194 s.readValues(buf, err, value, length, hasNull)
195}
196
197func (s compatiblePrimitiveListToArraySerializer) WriteData(ctx *WriteContext, value reflect.Value) {
198 ctx.SetError(SerializationErrorf("compatible list-to-array field serializer is read-only"))

Callers 1

ReadMethod · 0.95

Calls 13

checkBodyReadableMethod · 0.95
readValuesMethod · 0.95
DeserializationErrorfFunction · 0.85
ReadCollectionLengthMethod · 0.80
BufferMethod · 0.45
ErrMethod · 0.45
HasErrorMethod · 0.45
SetMethod · 0.45
TypeMethod · 0.45
ReadInt8Method · 0.45
ReadTypeInfoMethod · 0.45
TypeResolverMethod · 0.45

Tested by

no test coverage detected