ZipStreamReader { public List<ZipEntryWithContent> entries() { return entries; } ZipStreamReader(InputStream input, Predicate<String> entryNameMatcher, int maxEntrySizeInBytes); static void transferAndWrite(OutputStream out, InputStream in, String name, byte[] content); List<ZipEntryWithContent> entries();  }
@Test public void test_size_limit() { Map<String, String> entries = Map.of("foo.xml", "foobar"); try { new ZipStreamReader(new ByteArrayInputStream(zip(entries)), "foo.xml"::equals, 1); fail("Expected exception"); } catch (IllegalArgumentException ignored) {} entries = Map.of("foo.xml", "foobar", "foo.jar", "0".repeat(100) ); ZipStreamReader reader = new ZipStreamReader(new ByteArrayInputStream(zip(entries)), "foo.xml"::equals,10); byte[] extracted = reader.entries().get(0).content(); assertEquals("foobar", new String(extracted, StandardCharsets.UTF_8)); }