Decode the header from the beginning of the stream. This will decode the frame header and the first block header if enough bytes are provided. It is recommended to provide at least HeaderMaxSize bytes. If the frame header cannot be read an error will be returned. If there isn't enough input, io.ErrU
(in []byte)
| 95 | // If there isn't enough input, io.ErrUnexpectedEOF is returned. |
| 96 | // The FirstBlock.OK will indicate if enough information was available to decode the first block header. |
| 97 | func (h *Header) Decode(in []byte) error { |
| 98 | _, err := h.DecodeAndStrip(in) |
| 99 | return err |
| 100 | } |
| 101 | |
| 102 | // DecodeAndStrip will decode the header from the beginning of the stream |
| 103 | // and on success return the remaining bytes. |