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

Function ReadCombed

library/cpp/http/io/chunk_ut.cpp:40–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 }
39
40 void ReadCombed(IInputStream * stream, TString * contents, size_t chunkSize) {
41 Y_ASSERT(chunkSize < 128);
42 char buf[128];
43
44 contents->clear();
45 while (true) {
46 size_t read = stream->Load(buf, chunkSize);
47 contents->append(buf, read);
48 if (read == 0)
49 break;
50
51 size_t toSkip = chunkSize;
52 size_t skipped = 0;
53 do {
54 skipped = stream->Skip(toSkip);
55 toSkip -= skipped;
56 } while (skipped != 0 && toSkip != 0);
57 }
58 }
59
60 Y_UNIT_TEST(TestChunkedIo) {
61 TTempFile tmpFile(CDATA);

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 4

clearMethod · 0.45
LoadMethod · 0.45
appendMethod · 0.45
SkipMethod · 0.45

Tested by

no test coverage detected