bufioWriterBuffer grabs the buffer from a bufio.Writer.
(originalWriter io.Writer, bw *bufio.Writer)
| 352 | |
| 353 | // bufioWriterBuffer grabs the buffer from a bufio.Writer. |
| 354 | func 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 | } |
no outgoing calls