resetReader switches the current reader to the given reader. The old reader will be Close'd before setting the new reader.
(rc io.ReadCloser, offset int64)
| 217 | // resetReader switches the current reader to the given reader. |
| 218 | // The old reader will be Close'd before setting the new reader. |
| 219 | func (cr *sequential) resetReader(rc io.ReadCloser, offset int64) error { |
| 220 | if cr.rc != nil { |
| 221 | if err := cr.rc.Close(); err != nil { |
| 222 | return err |
| 223 | } |
| 224 | } |
| 225 | cr.rc = rc |
| 226 | cr.offset = offset |
| 227 | return nil |
| 228 | } |
| 229 | |
| 230 | var ( |
| 231 | _ ChunkedReader = (*sequential)(nil) |