MCPcopy Index your code
hub / github.com/aceld/zinx / decode

Method decode

zdecoder/tlvdecoder.go:97–111  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

95}
96
97func (tlv *TLVDecoder) decode(data []byte) *TLVDecoder {
98 tlvData := TLVDecoder{}
99 //Get T
100 tlvData.Tag = binary.BigEndian.Uint32(data[0:4])
101 //Get L
102 tlvData.Length = binary.BigEndian.Uint32(data[4:8])
103 //Determine the length of V. (确定V的长度)
104 tlvData.Value = make([]byte, tlvData.Length)
105
106 //Get V
107 binary.Read(bytes.NewBuffer(data[8:8+tlvData.Length]), binary.BigEndian, tlvData.Value)
108
109 //zlog.Ins().DebugF("TLV-DecodeData size:%d data:%+v\n", unsafe.Sizeof(data), tlvData)
110 return &tlvData
111}
112
113func (tlv *TLVDecoder) Intercept(chain ziface.IChain) ziface.IcResp {
114

Callers 1

InterceptMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected