![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
netty
文章平均质量分 87
我不是臭弟弟
好吃懒做 无所不为
展开
-
零拷贝
传统 IO 问题 传统的 IO 将一个文件通过 socket 写出 File f = new File("helloword/data.txt"); RandomAccessFile file = new RandomAccessFile(file, "r"); byte[] buf = new byte[(int)f.length()]; file.read(buf); Socket socket = ...; socket.getOutputStream().write(buf); 内部工作流程是原创 2021-03-31 21:10:17 · 238 阅读 · 0 评论 -
NIO基础--三大组件
non-blocking io 非阻塞 IO 1. 三大组件 1.1 Channel & Buffer channel 有一点类似于 stream,它就是读写数据的双向通道,可以从 channel 将数据读入 buffer,也可以将 buffer 的数据写入 channel,而之前的 stream 要么是输入,要么是输出,channel 比 stream 更为底层 #mermaid-svg-cW8kro41NMvXWohD .label{font-family:'trebuchet ms', ver原创 2021-03-23 22:01:35 · 184 阅读 · 0 评论