MCPcopy
hub / github.com/gorilla/websocket / bufioWriterBuffer

Function bufioWriterBuffer

server.go:354–365  ·  server.go::bufioWriterBuffer

bufioWriterBuffer grabs the buffer from a bufio.Writer.

(originalWriter io.Writer, bw *bufio.Writer)

Source from the content-addressed store, hash-verified

352
353// bufioWriterBuffer grabs the buffer from a bufio.Writer.
354func bufioWriterBuffer(originalWriter io.Writer, bw *bufio.Writer) []byte {
355 // This code assumes that bufio.Writer.buf[:1] is passed to the
356 // bufio.Writer's underlying writer.
357 var wh writeHook
358 bw.Reset(&wh)
359 bw.WriteByte(0)
360 bw.Flush()
361
362 bw.Reset(originalWriter)
363
364 return wh.p[:cap(wh.p)]
365}

Callers 2

UpgradeMethod · 0.85
TestBufioReuseFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestBufioReuseFunction · 0.68