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

Method ReadData

go/fory/slice_primitive.go:74–92  ·  view source on GitHub ↗
(ctx *ReadContext, value reflect.Value)

Source from the content-addressed store, hash-verified

72}
73
74func (s byteSliceSerializer) ReadData(ctx *ReadContext, value reflect.Value) {
75 buf := ctx.Buffer()
76 ctxErr := ctx.Err()
77 length := ctx.ReadBinaryLength()
78 if ctx.HasError() {
79 return
80 }
81 ptr := (*[]byte)(value.Addr().UnsafePointer())
82 if length == 0 {
83 *ptr = make([]byte, 0)
84 return
85 }
86 if !buf.CheckReadable(length, ctxErr) {
87 return
88 }
89 result := make([]byte, length)
90 buf.Read(result)
91 *ptr = result
92}
93
94type ByteSliceBufferObject struct {
95 data []byte

Callers 1

ReadMethod · 0.95

Calls 6

ReadBinaryLengthMethod · 0.80
CheckReadableMethod · 0.80
ReadMethod · 0.65
BufferMethod · 0.45
ErrMethod · 0.45
HasErrorMethod · 0.45

Tested by

no test coverage detected