MCPcopy Create free account
hub / github.com/catboost/catboost / Compress

Function Compress

library/cpp/neh/http2.cpp:191–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189 }
190
191 bool Compress(TData& data, const TString& compressionScheme) {
192 if (compressionScheme == "gzip" && data.size() > 23) { // there is no string less than 24 bytes long that might be compressed with gzip
193 try {
194 TData gzipped(data.size());
195 TMemoryOutput out(gzipped.data(), gzipped.size());
196 TZLibCompress c(&out, ZLib::GZip);
197 c.Write(data.data(), data.size());
198 c.Finish();
199 gzipped.resize(out.Buf() - gzipped.data());
200 data.swap(gzipped);
201 return true;
202 } catch (yexception&) {
203 // gzipped data occupies more space than original data
204 }
205 }
206 return false;
207 }
208
209 class THttpRequestBuffers: public NAsio::TTcpSocket::IBuffers {
210 public:

Callers 6

SendReplyMethod · 0.70
EmitHexArrayFunction · 0.50
CompressPathFunction · 0.50
mainFunction · 0.50
EncodeMethod · 0.50

Calls 7

sizeMethod · 0.45
dataMethod · 0.45
WriteMethod · 0.45
FinishMethod · 0.45
resizeMethod · 0.45
BufMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected