NOTE: not advancing roff here - see usage
(dst io.Writer)
| 128 | |
| 129 | // NOTE: not advancing roff here - see usage |
| 130 | func (z *SGL) WriteTo(dst io.Writer) (n int64, err error) { |
| 131 | var ( |
| 132 | n0 int |
| 133 | toWrite = z.woff |
| 134 | ) |
| 135 | for _, buf := range z.sgl { |
| 136 | l := cos.MinI64(toWrite, int64(len(buf))) |
| 137 | if l == 0 { |
| 138 | break |
| 139 | } |
| 140 | n0, err = dst.Write(buf[:l]) |
| 141 | n += int64(n0) |
| 142 | toWrite -= l |
| 143 | |
| 144 | if err != nil { |
| 145 | return |
| 146 | } |
| 147 | } |
| 148 | return |
| 149 | } |
| 150 | |
| 151 | func (z *SGL) Write(p []byte) (n int, err error) { |
| 152 | wlen := len(p) |
no test coverage detected