rdblue commented on code in PR #4537:
URL: https://github.com/apache/iceberg/pull/4537#discussion_r898266495


##########
core/src/main/java/org/apache/iceberg/io/IOUtil.java:
##########
@@ -46,6 +50,21 @@ public static void readFully(InputStream stream, byte[] 
bytes, int offset, int l
     }
   }
 
+  /**
+   * Writes a buffer into a stream, making multiple write calls if necessary.
+   */
+  public static void writeFully(OutputStream outputStream, ByteBuffer buffer) 
throws IOException {
+    if (!buffer.hasRemaining()) {
+      return;
+    }
+    byte[] chunk = new byte[WRITE_CHUNK_SIZE];

Review Comment:
   Rather than allocating every time this is called, can you create a 
`ThreadLocal` to share this buffer? Alternatively, you could pass the temporary 
buffer in.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to