Why Java NIO introduces Buffer class specially rat

2019-07-17 02:51发布

问题:

I was asked a question that why a byte array is not enough and NIO specially introduces a class Buffer?

What will be a good answer to this question? Is it only a kind of wrapper class which simplifies the read/write operation ?

If possible, please give us an example to demonstrate how we benefit from Buffer class which can not/hardly be done with an array.

标签: java io buffer nio