NewWriterSize returns a writer with a custom buffer size.
(w io.Writer, sz int)
| 128 | |
| 129 | // NewWriterSize returns a writer with a custom buffer size. |
| 130 | func NewWriterSize(w io.Writer, sz int) *Writer { |
| 131 | // we must be able to require() 'minWriterSize' |
| 132 | // contiguous bytes, so that is the |
| 133 | // practical minimum buffer size |
| 134 | if sz < minWriterSize { |
| 135 | sz = minWriterSize |
| 136 | } |
| 137 | buf := make([]byte, sz) |
| 138 | return NewWriterBuf(w, buf) |
| 139 | } |
| 140 | |
| 141 | // NewWriterBuf returns a writer with a provided buffer. |
| 142 | // 'buf' is not used when the capacity is smaller than 18, |
no test coverage detected
searching dependent graphs…