Reading methods.
(ctx context.Context)
| 219 | |
| 220 | // Reading methods. |
| 221 | func (p *TJSONProtocol) ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqId int32, err error) { |
| 222 | p.resetContextStack() // THRIFT-3735 |
| 223 | if isNull, err := p.ParseListBegin(); isNull || err != nil { |
| 224 | return name, typeId, seqId, err |
| 225 | } |
| 226 | version, err := p.ReadI32(ctx) |
| 227 | if err != nil { |
| 228 | return name, typeId, seqId, err |
| 229 | } |
| 230 | if version != THRIFT_JSON_PROTOCOL_VERSION { |
| 231 | e := fmt.Errorf("Unknown Protocol version %d, expected version %d", version, THRIFT_JSON_PROTOCOL_VERSION) |
| 232 | return name, typeId, seqId, NewTProtocolExceptionWithType(INVALID_DATA, e) |
| 233 | |
| 234 | } |
| 235 | if name, err = p.ReadString(ctx); err != nil { |
| 236 | return name, typeId, seqId, err |
| 237 | } |
| 238 | bTypeId, err := p.ReadByte(ctx) |
| 239 | typeId = TMessageType(bTypeId) |
| 240 | if err != nil { |
| 241 | return name, typeId, seqId, err |
| 242 | } |
| 243 | if seqId, err = p.ReadI32(ctx); err != nil { |
| 244 | return name, typeId, seqId, err |
| 245 | } |
| 246 | return name, typeId, seqId, nil |
| 247 | } |
| 248 | |
| 249 | func (p *TJSONProtocol) ReadMessageEnd(ctx context.Context) error { |
| 250 | err := p.ParseListEnd() |
nothing calls this directly
no test coverage detected