Reads a byte array from the provided stream. If the size of the stream exceedes maxLengthvalue is set to null and this function returns false.
This method can be used to limit the byte size returned. Since an untrusted source could claim that the length is int.MaxValue, this prevents allocating 2GB of RAM to store the result.