tzulitai commented on a change in pull request #14042:
URL: https://github.com/apache/flink/pull/14042#discussion_r524049020
##########
File path: flink-core/src/main/java/org/apache/flink/util/IOUtils.java
##########
@@ -143,6 +143,30 @@ public static void readFully(final InputStream in, final
byte[] buf, int off, fi
}
}
+ /**
+ * Similar to readFully(). Returns the total number of bytes read into
the buffer.
+ * @param in
+ * The InputStream to read from
+ * @param buf
+ * The buffer to fill
+ * @return
+ * The total number of bytes read into the buffer
+ * @throws IOException
+ * If the first byte cannot be read for any reason other than
end of file,
+ * or if the input stream has been closed, or if some other I/O
error occurs.
+ */
+ public static int readFully(final InputStream in, final byte[] buf)
throws IOException {
Review comment:
nit: I would like to rename this to `tryReadFully`, as it has different
usage contracts compared to the usual `readFully` method we're familiar with.
e.g. this method doesn't throw when EOF is reached.
##########
File path: flink-core/src/test/java/org/apache/flink/util/IOUtilsTest.java
##########
@@ -0,0 +1,34 @@
+package org.apache.flink.util;
Review comment:
file missing license header
----------------------------------------------------------------
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:
[email protected]