MCPcopy
hub / github.com/tinylib/msgp / Write

Method Write

msgp/write.go:285–297  ·  view source on GitHub ↗

Write implements io.Writer, and writes data directly to the buffer.

(p []byte)

Source from the content-addressed store, hash-verified

283// Write implements io.Writer, and writes
284// data directly to the buffer.
285func (mw *Writer) Write(p []byte) (int, error) {
286 l := len(p)
287 if mw.avail() < l {
288 if err := mw.flush(); err != nil {
289 return 0, err
290 }
291 if l > len(mw.buf) {
292 return mw.w.Write(p)
293 }
294 }
295 mw.wloc += copy(mw.buf[mw.wloc:], p)
296 return l, nil
297}
298
299// implements io.WriteString
300func (mw *Writer) writeString(s string) error {

Callers 2

WriteBytesMethod · 0.95
WriteStringFromBytesMethod · 0.95

Calls 3

availMethod · 0.95
flushMethod · 0.95
WriteMethod · 0.45

Tested by

no test coverage detected