阻塞仍是不阻塞,輪詢仍是事件驅動異步
Netty是事件驅動的事件
Java has two kinds of classes for input and output (I/O): streams and readers/writers.ci
Streams (InputStream, OutputStream and everything that extends these) are for reading and writing binary data from files, the network, or whatever other device.input
Readers and writers are for reading and writing text (characters). They are a layer on top of streams, that converts binary data (bytes) to characters and back, using a character encoding.同步
Reading data from disk byte-by-byte is very inefficient. One way to speed it up is to use a buffer: instead of reading one byte at a time, you read a few thousand bytes at once, and put them in a buffer, in memory. Then you can look at the bytes in the buffer one by one.it
Channel與Stream的區別在於:Channel是雙向的,而Stream只能是單向的io
Channel是以一個chunk一個chunk爲單位讀寫的,可是stream說白了仍是依賴一個byte一個byte的bufferclass
As previously mentioned, original I/O deals with data in streams, whereas NIO deals with data in blocks.stream