ReadAt implements io.ReaderAt on the bytes in v.
(p []byte, off int64)
| 146 | |
| 147 | // ReadAt implements io.ReaderAt on the bytes in v. |
| 148 | func (v ByteView) ReadAt(p []byte, off int64) (n int, err error) { |
| 149 | if off < 0 { |
| 150 | return 0, errors.New("view: invalid offset") |
| 151 | } |
| 152 | if off >= int64(v.Len()) { |
| 153 | return 0, io.EOF |
| 154 | } |
| 155 | n = v.SliceFrom(int(off)).Copy(p) |
| 156 | if n < len(p) { |
| 157 | err = io.EOF |
| 158 | } |
| 159 | return |
| 160 | } |
| 161 | |
| 162 | // WriteTo implements io.WriterTo on the bytes in v. |
| 163 | func (v ByteView) WriteTo(w io.Writer) (n int64, err error) { |