Sort shuffle read improvements

Hi @sryza , I've done some improvements in current SortSHuffleRead, would you mind help reviewing this and give me some comments, thanks a lot!

1. copy memory shuffle block from off-heap to on-heap if memory is allocated with direct memory to control the off-heap memory size.
2. Some code style modification and better failure processing logic.
Hi Sandy, there's a bug around here:

```
java.lang.IndexOutOfBoundsException: 1
        at scala.collection.mutable.ResizableArray$class.apply(ResizableArray.scala:43)
        at scala.collection.mutable.ArrayBuffer.apply(ArrayBuffer.scala:47)
        at scala.collection.mutable.ArrayBuffer.apply(ArrayBuffer.scala:47)
        at scala.collection.immutable.Range.foreach(Range.scala:141)
        at org.apache.spark.util.collection.TieredDiskMerger$DiskToDiskMerger.run(TieredDiskMerger.scala:188)
```
I'm guessing this `Range.foreach` may have some problems with `queue.take`. I changed to while loop to try again, seems the exception is gone.