Netty Authoritative Guide Reading Notes (3)

1. The nio class library
SocketChannel and ServerSocketChannel correspond to io's Socket and ServerSocket. The first two support both blocking and non-blocking modes. nio provides high-speed block-oriented IO in standard java, taking advantage of low-level optimizations without using native code.
2.buffer buffer
In stream-oriented IO, data can be directly written or read directly into the Stream object. In NIO, all data is processed with buffers, read data is directly read into the buffer, write data is directly written into the buffer, any time to access the data in NIO, it is through the buffer area operates.
A buffer is an array, not just an array, that provides structured access to data and maintains information such as read and write positions.
3.channel channel
Stream : move in only one direction, a stream must be a subclass of InputStream or OutputStream.
Channel: Can be used for reading, writing or both. (Full-duplex, in the UNIX network programming model, the channels of the underlying operating system are also full-duplex, and support read and write operations)
SelectableChannel: used for network read and write
FileChannel: used for file operations

From : http://blog .csdn.net/xxcupid/article/details/50492198

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327064232&siteId=291194637