| 569 | } |
| 570 | |
| 571 | func (p *TSimpleJSONProtocol) ReadBinary(ctx context.Context) ([]byte, error) { |
| 572 | var v []byte |
| 573 | if err := p.ParsePreValue(); err != nil { |
| 574 | return nil, err |
| 575 | } |
| 576 | f, _ := p.reader.Peek(1) |
| 577 | if len(f) > 0 && f[0] == JSON_QUOTE { |
| 578 | p.reader.ReadByte() |
| 579 | value, err := p.ParseBase64EncodedBody() |
| 580 | v = value |
| 581 | if err != nil { |
| 582 | return v, err |
| 583 | } |
| 584 | } else if len(f) > 0 && f[0] == JSON_NULL[0] { |
| 585 | b := make([]byte, len(JSON_NULL)) |
| 586 | _, err := p.reader.Read(b) |
| 587 | if err != nil { |
| 588 | return v, NewTProtocolException(err) |
| 589 | } |
| 590 | if string(b) != string(JSON_NULL) { |
| 591 | e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(b)) |
| 592 | return v, NewTProtocolExceptionWithType(INVALID_DATA, e) |
| 593 | } |
| 594 | } else { |
| 595 | e := fmt.Errorf("Expected a JSON string, found unquoted data started with %s", string(f)) |
| 596 | return v, NewTProtocolExceptionWithType(INVALID_DATA, e) |
| 597 | } |
| 598 | |
| 599 | return v, p.ParsePostValue() |
| 600 | } |
| 601 | |
| 602 | func (p *TSimpleJSONProtocol) ReadUUID(ctx context.Context) (v Tuuid, err error) { |
| 603 | var s string |