| 171 | |
| 172 | |
| 173 | std::string SlpkInterface::fetchJson(std::string filepath) |
| 174 | { |
| 175 | filepath += ".json.gz"; |
| 176 | auto li = m_locMap.find(filepath); |
| 177 | if (li == m_locMap.end()) |
| 178 | throw pdal_error("Couldn't find file '" + filepath + "' in SLPK file '" + |
| 179 | m_filename + "'."); |
| 180 | |
| 181 | Location& loc = li->second; |
| 182 | |
| 183 | std::string output; |
| 184 | const char *c = reinterpret_cast<const char *>(m_ctx.addr()) + loc.m_pos; |
| 185 | GzipDecompressor decomp( |
| 186 | [&output](char *buf, size_t bufsize){output.append(buf, buf + bufsize);}); |
| 187 | decomp.decompress(c, loc.m_length); |
| 188 | decomp.done(); |
| 189 | return output; |
| 190 | } |
| 191 | |
| 192 | // fetch data using arbiter to get a char vector |
| 193 | std::vector<char> SlpkInterface::fetchBinary(std::string url, std::string attNum, |