Read implements the io.ZeroCopySource interface.
(n uint64)
| 55 | |
| 56 | // Read implements the io.ZeroCopySource interface. |
| 57 | func (self *ZeroCopySource) NextBytes(n uint64) (data []byte, eof bool) { |
| 58 | m := uint64(len(self.s)) |
| 59 | end, overflow := SafeAdd(self.off, n) |
| 60 | if overflow || end > m { |
| 61 | end = m |
| 62 | eof = true |
| 63 | } |
| 64 | data = self.s[self.off:end] |
| 65 | self.off = end |
| 66 | |
| 67 | return |
| 68 | } |
| 69 | |
| 70 | func (self *ZeroCopySource) Skip(n uint64) (eof bool) { |
| 71 | m := uint64(len(self.s)) |