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


##########
src/main/java/org/apache/commons/compress/harmony/pack200/PackingUtils.java:
##########
@@ -144,14 +137,11 @@ public static void copyThroughJar(final JarInputStream 
jarInputStream, final Out
 
     public static List<PackingFile> getPackingFileListFromJar(final JarFile 
jarFile, final boolean keepFileOrder) throws IOException {
         final List<PackingFile> packingFileList = new ArrayList<>();
-        final Enumeration<JarEntry> jarEntries = jarFile.entries();
-        while (jarEntries.hasMoreElements()) {
-            final JarEntry jarEntry = jarEntries.nextElement();
+        IOConsumer.forEach(jarFile.stream(), jarEntry -> {
             try (InputStream inputStream = jarFile.getInputStream(jarEntry)) {
-                final byte[] bytes = readJarEntry(jarEntry, new 
BufferedInputStream(inputStream));
-                packingFileList.add(new PackingFile(bytes, jarEntry));
+                packingFileList.add(new PackingFile(readJarEntry(jarEntry, 
inputStream), jarEntry));

Review Comment:
   Buffering is no longer necessary: Commons IO uses optimal size buffers to 
copy data.



-- 
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