MCPcopy Create free account
hub / github.com/Merovius/nbd / encoder

Struct encoder

handshake.go:345–349  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

343// append to buf. That way, nested messages can be buffered before writing them
344// out, to determine their length.
345type encoder struct {
346 rw io.ReadWriter
347 buf []byte
348 check func(error)
349}
350
351func (e *encoder) write(b []byte) {
352 if e.buf != nil {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected