helfper commented on a change in pull request #145:
URL: https://github.com/apache/ant/pull/145#discussion_r593746382



##########
File path: src/main/org/apache/tools/zip/ZipOutputStream.java
##########
@@ -901,6 +901,20 @@ public boolean canWriteEntryData(ZipEntry ae) {
         return ZipUtil.canHandleEntryData(ae);
     }
 
+    /**
+     * Writes a byte to ZIP entry.
+     *
+     * @param b the byte to write
+     * @throws IOException on error
+     * @since Ant 1.10.10
+     */
+    @Override
+    public void write(int b) throws IOException {
+        byte[] buf = new byte[1];

Review comment:
       Agreed, I thought about that but was wondering why 
`DeflaterOutputStream` didn't do it. I did it now as this class is not 
thread-safe anyway, and this allocation on every write may keep the GC 
unnecessarily busy. I checked Apache Commons Compress since you mentioned it 
and it's also how it's done there: 
https://github.com/apache/commons-compress/blob/master/src/main/java/org/apache/commons/compress/archivers/ArchiveOutputStream.java#L52




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to