(frag *BinaryFragment, r io.Reader)
| 165 | } |
| 166 | |
| 167 | func inflateBinaryChunk(frag *BinaryFragment, r io.Reader) error { |
| 168 | zr, err := zlib.NewReader(r) |
| 169 | if err != nil { |
| 170 | return err |
| 171 | } |
| 172 | |
| 173 | data, err := ioutil.ReadAll(zr) |
| 174 | if err != nil { |
| 175 | return err |
| 176 | } |
| 177 | if err := zr.Close(); err != nil { |
| 178 | return err |
| 179 | } |
| 180 | |
| 181 | if int64(len(data)) != frag.Size { |
| 182 | return fmt.Errorf("%d byte fragment inflated to %d", frag.Size, len(data)) |
| 183 | } |
| 184 | frag.Data = data |
| 185 | return nil |
| 186 | } |
no test coverage detected