MCPcopy
hub / github.com/google/brotli / testEagerStream

Method testEagerStream

java/org/brotli/dec/EagerStreamTest.java:367–385  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

365 }
366
367 @Test
368 public void testEagerStream() throws IOException {
369 ProxyStream ps = new ProxyStream(new ByteArrayInputStream(DATA));
370 BrotliInputStream reader = new BrotliInputStream(ps, 1);
371 byte[] buffer = new byte[1];
372 reader.read(buffer);
373 reader.close();
374 int normalReadBytes = ps.readBytes;
375
376 ps = new ProxyStream(new ByteArrayInputStream(DATA));
377 reader = new BrotliInputStream(ps, 1);
378 reader.enableEagerOutput();
379 reader.read(buffer);
380 reader.close();
381 int eagerReadBytes = ps.readBytes;
382
383 // Did not continue decoding - suspended as soon as enough data was decoded.
384 assertTrue(eagerReadBytes < normalReadBytes);
385 }
386}

Callers

nothing calls this directly

Calls 3

readMethod · 0.95
closeMethod · 0.95
enableEagerOutputMethod · 0.95

Tested by

no test coverage detected