IO是面向字节流方法(Stream Oriented),相对于NIO的面向缓冲形方法(Buffer oriented),IO没有缓存,你可以同时读取多个字节,但读取代码不能向前后移动。缓冲形方法可以让代码缓冲一段时间,这样代码更有弹性。
Java NIO's buffer oriented approach is slightly different. Data is read into a buffer from which
it is later processed. You can move forth and back in the buffer as you need to. This gives you
a bit more flexibility during processing. However, you also need to check if the buffer contains
all the data you need in order to fully process it. And, you need to make sure that when reading
more data into the buffer, you do not overwrite data in the buffer you have not yet processed.
IO的底层也是NIO实现