EqualBytes returns whether the bytes in b are the same as the bytes in b2.
(b2 []byte)
| 121 | // EqualBytes returns whether the bytes in b are the same as the bytes |
| 122 | // in b2. |
| 123 | func (v ByteView) EqualBytes(b2 []byte) bool { |
| 124 | if v.b != nil { |
| 125 | return bytes.Equal(v.b, b2) |
| 126 | } |
| 127 | l := v.Len() |
| 128 | if len(b2) != l { |
| 129 | return false |
| 130 | } |
| 131 | for i, bi := range b2 { |
| 132 | if bi != v.s[i] { |
| 133 | return false |
| 134 | } |
| 135 | } |
| 136 | return true |
| 137 | } |
| 138 | |
| 139 | // Reader returns an io.ReadSeeker for the bytes in v. |
| 140 | func (v ByteView) Reader() io.ReadSeeker { |