Fokko commented on code in PR #3550:
URL: https://github.com/apache/parquet-java/pull/3550#discussion_r3213845157


##########
parquet-common/src/main/java/org/apache/parquet/bytes/BytesInput.java:
##########
@@ -395,8 +404,11 @@ void writeInto(ByteBuffer buffer) {
 
     public byte[] toByteArray() throws IOException {
       LOG.debug("read all {} bytes", byteCount);
-      byte[] buf = new byte[byteCount];
-      new DataInputStream(in).readFully(buf);
+      byte[] buf = in.readNBytes(byteCount);

Review Comment:
   I think it is nice to avoid the wrapper `DataInputStream` here. The biggest 
win here is in `writeAllTo` where we don't allocate all the bytes directly into 
memory, but respecting `byteCount`.



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