encoder provides helper methods for easy de-/encoding of binary data. If an error occurs, it calls check, which is expected to panic if its non-nil. If buf is non-nil, the encoder won't write to rw directly, but append to buf. That way, nested messages can be buffered before writing them out, to det
| 343 | // append to buf. That way, nested messages can be buffered before writing them |
| 344 | // out, to determine their length. |
| 345 | type encoder struct { |
| 346 | rw io.ReadWriter |
| 347 | buf []byte |
| 348 | check func(error) |
| 349 | } |
| 350 | |
| 351 | func (e *encoder) write(b []byte) { |
| 352 | if e.buf != nil { |
nothing calls this directly
no outgoing calls
no test coverage detected