public static void readFully(InputStream in, byte[] b, int off, int len) throws IOException {
    int read = read(in, b, off, len);
    if (read != len) {
      throw new EOFException(
          "reached end of stream after reading " + read + " bytes; " + len + " bytes expected");
    }
  }
Attempts to read {@code len} bytes from the stream into the given array starting at {@code
off}, with the same behavior as {@link DataInput#readFully(byte[], int, int)}. Does not close
the stream.

@param in the input stream to read from.
@param b the buffer into which the data is read.
@param off an int specifying the offset into the data.
@param len an int specifying the number of bytes to read.
@throws EOFException if this stream reaches the end before reading all the bytes.
@throws IOException if an I/O error occurs.
fbcore/src/main/java/com/facebook/common/internal/ByteStreams.java