ReadExtensionBytes reads an extension from 'b' into 'e' and returns any remaining bytes. Possible errors: - ErrShortBytes ('b' not long enough) - ExtensionTypeError{} (wire type not the same as e.Type()) - TypeError{} (next object not an extension) - InvalidPrefixError - An umarshal error returned f
(b []byte, e Extension)
| 490 | // - InvalidPrefixError |
| 491 | // - An umarshal error returned from e.UnmarshalBinary |
| 492 | func ReadExtensionBytes(b []byte, e Extension) ([]byte, error) { |
| 493 | typ, remain, data, err := readExt(b) |
| 494 | if err != nil { |
| 495 | return b, err |
| 496 | } |
| 497 | if typ != e.ExtensionType() { |
| 498 | return b, errExt(typ, e.ExtensionType()) |
| 499 | } |
| 500 | return remain, e.UnmarshalBinary(data) |
| 501 | } |
| 502 | |
| 503 | // readExt will read the extension type, and return remaining bytes, |
| 504 | // as well as the data of the extension. |
searching dependent graphs…