readBytes reads the given number of bytes
(n uint32)
| 160 | |
| 161 | // readBytes reads the given number of bytes |
| 162 | func (r *reader) readBytes(n uint32) []byte { |
| 163 | // Fast path if we're byte aligned |
| 164 | if r.bitCount&7 == 0 { |
| 165 | if r.bitCount != 0 { |
| 166 | r.realign() |
| 167 | } |
| 168 | r.pos += n |
| 169 | if r.pos > r.size { |
| 170 | _panicf("readBytes: insufficient buffer (%d of %d)", r.pos, r.size) |
| 171 | } |
| 172 | return r.buf[r.pos-n : r.pos] |
| 173 | } |
| 174 | |
| 175 | buf := make([]byte, n) |
| 176 | for i := uint32(0); i < n; i++ { |
| 177 | buf[i] = byte(r.readBits(8)) |
| 178 | } |
| 179 | return buf |
| 180 | } |
| 181 | |
| 182 | // readLeUint32 reads an little-endian uint32 |
| 183 | func (r *reader) readLeUint32() uint32 { |
no test coverage detected