** * Reading methods */
(ctx context.Context)
| 270 | */ |
| 271 | |
| 272 | func (p *TBinaryProtocol) ReadMessageBegin(ctx context.Context) (name string, typeId TMessageType, seqId int32, err error) { |
| 273 | size, e := p.ReadI32(ctx) |
| 274 | if e != nil { |
| 275 | return "", typeId, 0, NewTProtocolException(e) |
| 276 | } |
| 277 | if size < 0 { |
| 278 | typeId = TMessageType(size & 0x0ff) |
| 279 | version := int64(int64(size) & VERSION_MASK) |
| 280 | if version != VERSION_1 { |
| 281 | return name, typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, fmt.Errorf("Bad version in ReadMessageBegin")) |
| 282 | } |
| 283 | name, e = p.ReadString(ctx) |
| 284 | if e != nil { |
| 285 | return name, typeId, seqId, NewTProtocolException(e) |
| 286 | } |
| 287 | seqId, e = p.ReadI32(ctx) |
| 288 | if e != nil { |
| 289 | return name, typeId, seqId, NewTProtocolException(e) |
| 290 | } |
| 291 | return name, typeId, seqId, nil |
| 292 | } |
| 293 | if p.cfg.GetTBinaryStrictRead() { |
| 294 | return name, typeId, seqId, NewTProtocolExceptionWithType(BAD_VERSION, fmt.Errorf("Missing version in ReadMessageBegin")) |
| 295 | } |
| 296 | name, e2 := p.readStringBody(size) |
| 297 | if e2 != nil { |
| 298 | return name, typeId, seqId, e2 |
| 299 | } |
| 300 | b, e3 := p.ReadByte(ctx) |
| 301 | if e3 != nil { |
| 302 | return name, typeId, seqId, e3 |
| 303 | } |
| 304 | typeId = TMessageType(b) |
| 305 | seqId, e4 := p.ReadI32(ctx) |
| 306 | if e4 != nil { |
| 307 | return name, typeId, seqId, e4 |
| 308 | } |
| 309 | return name, typeId, seqId, nil |
| 310 | } |
| 311 | |
| 312 | func (p *TBinaryProtocol) ReadMessageEnd(ctx context.Context) error { |
| 313 | return nil |
nothing calls this directly
no test coverage detected