(r io.Reader)
| 191 | } |
| 192 | |
| 193 | func (x *xerialWriter) ReadFrom(r io.Reader) (int64, error) { |
| 194 | wn := int64(0) |
| 195 | |
| 196 | if cap(x.input) == 0 { |
| 197 | x.input = make([]byte, 0, defaultBufferSize) |
| 198 | } |
| 199 | |
| 200 | for { |
| 201 | if x.full() { |
| 202 | x.grow() |
| 203 | } |
| 204 | |
| 205 | n, err := r.Read(x.input[len(x.input):cap(x.input)]) |
| 206 | wn += int64(n) |
| 207 | x.input = x.input[:len(x.input)+n] |
| 208 | |
| 209 | if x.fullEnough() { |
| 210 | if err := x.Flush(); err != nil { |
| 211 | return wn, err |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | if err != nil { |
| 216 | if errors.Is(err, io.EOF) { |
| 217 | err = nil |
| 218 | } |
| 219 | return wn, err |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | func (x *xerialWriter) Write(b []byte) (int, error) { |
| 225 | wn := 0 |
nothing calls this directly
no test coverage detected