[SPARK-3948][Shuffle]Fix stream corruption bug in sort-based shuffle

Kernel 2.6.32 bug will lead to unexpected behavior of transferTo in copyStream, and this will corrupt the shuffle output file in sort-based shuffle, which will somehow introduce PARSING_ERROR(2), deserialization error or offset out of range. Here fix this by adding append flag, also add some position checking code. Details can be seen in [SPARK-3948](https://issues.apache.org/jira/browse/SPARK-3948).
IMHO, I think NIO way will gain much better performance, especially in shuffle. Though we met some issues with specific kernel version, mostly this exception will not be met, I think we should balance the trade-off between seldom met exception and performance gain. 

If we hopes people to never use `transferTo`, why not directly remove this code path and configuration, this will be more straightforward.