| 131 | } |
| 132 | |
| 133 | func (d *wsDecompressor) nextBuf() []byte { |
| 134 | // We still have remaining data in the first buffer |
| 135 | if d.off != len(d.bufs[0]) { |
| 136 | return d.bufs[0] |
| 137 | } |
| 138 | // We read the full first buffer. Reset offset. |
| 139 | d.off = 0 |
| 140 | // We were at the last buffer, so we are done. |
| 141 | if len(d.bufs) == 1 { |
| 142 | d.bufs = nil |
| 143 | return nil |
| 144 | } |
| 145 | // Here we move to the next buffer. |
| 146 | d.bufs = d.bufs[1:] |
| 147 | return d.bufs[0] |
| 148 | } |
| 149 | |
| 150 | func (d *wsDecompressor) ReadByte() (byte, error) { |
| 151 | if len(d.bufs) == 0 { |