ReadByteSlice reads []byte with optional ref/type info
(refMode RefMode, readType bool)
| 508 | |
| 509 | // ReadByteSlice reads []byte with optional ref/type info |
| 510 | func (c *ReadContext) ReadByteSlice(refMode RefMode, readType bool) []byte { |
| 511 | err := c.Err() |
| 512 | if refMode != RefModeNone { |
| 513 | if c.buffer.ReadInt8(err) == NullFlag { |
| 514 | return nil |
| 515 | } |
| 516 | } |
| 517 | if readType { |
| 518 | actual := TypeId(c.buffer.ReadUint8(err)) |
| 519 | if actual != BINARY && actual != UINT8_ARRAY { |
| 520 | c.SetError(DeserializationErrorf("slice type mismatch: expected BINARY (%d) or UINT8_ARRAY (%d), got %d", BINARY, UINT8_ARRAY, actual)) |
| 521 | return nil |
| 522 | } |
| 523 | } |
| 524 | size := c.ReadBinaryLength() |
| 525 | return c.buffer.ReadBinary(size, err) |
| 526 | } |
| 527 | |
| 528 | // ReadStringSlice reads []string with optional ref/type info using LIST protocol |
| 529 | func (c *ReadContext) ReadStringSlice(refMode RefMode, readType bool) []string { |
no test coverage detected