[SPARK-3135] Avoid extra mem copy in TorrentBroadcast via ByteArrayChunkOutputStream

This also enables supporting broadcast variables larger than 2G.
If position is 0, I think the correct behavior would be to not return the last allocated buffer, at least to be consistent with the base case. To note, there should not be a 0-position buffer with the current code, but nor should would it be incorrect if one existed in the future or due to an exception after allocateNewChunkIfNeeded().