Seek wraps the underlying Seeker's "Seek" method, updating the number of bytes that have been consumed by this reader.
(offset int64, whence int)
| 49 | // Seek wraps the underlying Seeker's "Seek" method, updating the number of |
| 50 | // bytes that have been consumed by this reader. |
| 51 | func (r *BodyWithCallback) Seek(offset int64, whence int) (int64, error) { |
| 52 | switch whence { |
| 53 | case io.SeekStart: |
| 54 | r.readSize = offset |
| 55 | case io.SeekCurrent: |
| 56 | r.readSize += offset |
| 57 | case io.SeekEnd: |
| 58 | r.readSize = r.totalSize + offset |
| 59 | } |
| 60 | |
| 61 | return r.ReadSeekCloser.Seek(offset, whence) |
| 62 | } |
| 63 | |
| 64 | // ResetProgress calls the callback with a negative read size equal to the |
| 65 | // total number of bytes read so far, effectively "resetting" the progress. |
no outgoing calls