ppkarwasz commented on code in PR #709:
URL: https://github.com/apache/commons-compress/pull/709#discussion_r2373160073


##########
src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java:
##########
@@ -240,7 +238,11 @@ private TarFile(final Builder builder) throws IOException {
         this.recordBuffer = ByteBuffer.allocate(this.recordSize);
         this.blockSize = builder.getBlockSize();
         this.lenient = builder.isLenient();
-        forEach(entries::add);
+        // Read all entries eagerly
+        TarArchiveEntry entry;
+        while ((entry = getNextTarEntry()) != null) {
+            entries.add(entry);
+        }

Review Comment:
   The previous implementation wasn't lazy either, although we should probably 
implement `stream` in a lazy way.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to