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

Method Read

go/fory/pointer.go:267–293  ·  view source on GitHub ↗
(ctx *ReadContext, refMode RefMode, readType bool, hasGenerics bool, value reflect.Value)

Source from the content-addressed store, hash-verified

265}
266
267func (s *ptrToInterfaceSerializer) Read(ctx *ReadContext, refMode RefMode, readType bool, hasGenerics bool, value reflect.Value) {
268 buf := ctx.Buffer()
269 ctxErr := ctx.Err()
270 switch refMode {
271 case RefModeTracking:
272 refID, refErr := ctx.RefResolver().TryPreserveRefId(buf)
273 if refErr != nil {
274 ctx.SetError(FromError(refErr))
275 return
276 }
277 if refID < int32(NotNullValueFlag) {
278 // Reference found
279 obj := ctx.RefResolver().GetReadObject(refID)
280 if obj.IsValid() {
281 value.Set(obj)
282 }
283 return
284 }
285 case RefModeNullOnly:
286 flag := buf.ReadInt8(ctxErr)
287 if flag == NullFlag {
288 return
289 }
290 }
291
292 s.ReadData(ctx, value)
293}
294
295func (s *ptrToInterfaceSerializer) ReadWithTypeInfo(ctx *ReadContext, refMode RefMode, typeInfo *TypeInfo, value reflect.Value) {
296 s.Read(ctx, refMode, false, false, value)

Callers 1

ReadWithTypeInfoMethod · 0.95

Calls 11

ReadDataMethod · 0.95
FromErrorFunction · 0.85
TryPreserveRefIdMethod · 0.80
GetReadObjectMethod · 0.80
int32Function · 0.50
BufferMethod · 0.45
ErrMethod · 0.45
RefResolverMethod · 0.45
SetErrorMethod · 0.45
SetMethod · 0.45
ReadInt8Method · 0.45

Tested by

no test coverage detected