SkipToNoCheck for skip to the none StructEnd tag.
(tag byte, require bool)
| 533 | |
| 534 | // SkipToNoCheck for skip to the none StructEnd tag. |
| 535 | func (b *Reader) SkipToNoCheck(tag byte, require bool) (bool, byte, error) { |
| 536 | for { |
| 537 | tyCur, tagCur, err := b.readHead() |
| 538 | if err != nil { |
| 539 | if require { |
| 540 | return false, tyCur, fmt.Errorf("can not find Tag %d. But require. %s", tag, err.Error()) |
| 541 | } |
| 542 | return false, tyCur, nil |
| 543 | } |
| 544 | if tyCur == StructEnd || tagCur > tag { |
| 545 | if require { |
| 546 | return false, tyCur, fmt.Errorf("can not find Tag %d. But require. tagCur: %d, tyCur: %d", |
| 547 | tag, tagCur, tyCur) |
| 548 | } |
| 549 | // 多读了一个head, 退回去. |
| 550 | b.unreadHead(tagCur) |
| 551 | return false, tyCur, nil |
| 552 | } |
| 553 | if tagCur == tag { |
| 554 | return true, tyCur, nil |
| 555 | } |
| 556 | |
| 557 | // tagCur < tag |
| 558 | if err = b.skipField(tyCur); err != nil { |
| 559 | return false, tyCur, err |
| 560 | } |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | // SkipTo skip to the given tag. |
| 565 | func (b *Reader) SkipTo(ty, tag byte, require bool) (bool, error) { |