Java NIO Tutorial
Java NIO Tutorial
Java NIO (New IO) is an alternative IO API for Java (from Java 1.4), meaning alternative to the standardJava IO and Java Networking API's. Java NIO offers a different way of working with IO than the standard IO API's.
NIO是一个可供替代的 io API, 可以用来代替原来的IO 和网络 API。
Java NIO: Channels and Buffers
In the standard IO API you work with byte streams and character streams. In NIO you work with channels and buffers. Data is always read from a channel into a buffer, or written from a buffer to a channel.
标准IO api 是用 字节流和 字符流工作;NIO是用 通道 Channel和缓冲 buffer 工作,数据是从Channel读到buffer,从buffer写到Channel
Java NIO: Non-blocking IO
nio是非阻塞io,thread让Channel读数据到buffer,然后线程可以做其他事,读完了可以继续处理他。
Java NIO enables you to do non-blocking IO. For instance, a thread can ask a channel to read data into a buffer. While the channel reads data into the buffer, the thread can do something else. Once data is read into the buffer, the thread can then continue processing it. The same is true for writing data to channels.
Java NIO: Selectors
一个selector可以模拟操作多个Channel的处理数据。
Java NIO contains the concept of "selectors". A selector is an object that can monitor multiple channels for events (like: connection opened, data arrived etc.). Thus, a single thread can monitor multiple channels for data.
How all this works is explained in more detail in the next text in this series - the Java NIO overview.
Java NIO Tutorial的更多相关文章
- The Rox Java NIO Tutorial
FQ之后访问 http://rox-xmlrpc.sourceforge.net/niotut/
- 快学Java NIO 续篇
可以先看Java NIO的整体介绍,这篇接着说以下内容,<快学Java NIO>续篇 FileChannel SocketChannel ServerSocketChannel Java ...
- 快学Java NIO
Java NIO Tutorial 地址:http://tutorials.jenkov.com/java-nio/index.html Java NIO系列教程译文地址:http://ifeve.c ...
- Java NIO 完全学习笔记(转)
本篇博客依照 Java NIO Tutorial翻译,算是学习 Java NIO 的一个读书笔记.建议大家可以去阅读原文,相信你肯定会受益良多. 1. Java NIO Tutorial Java N ...
- Java NIO 核心组件学习笔记
背景知识 同步.异步.阻塞.非阻塞 首先,这几个概念非常容易搞混淆,但NIO中又有涉及,所以总结一下[1]. 同步:API调用返回时调用者就知道操作的结果如何了(实际读取/写入了多少字节). 异步:相 ...
- Java NIO Overview
Java NIO Overview Channels and Buffers Selectors Jakob JenkovLast update: 2014-06-23
- Java NIO 学习笔记(一)----概述,Channel/Buffer
目录: Java NIO 学习笔记(一)----概述,Channel/Buffer Java NIO 学习笔记(二)----聚集和分散,通道到通道 Java NIO 学习笔记(三)----Select ...
- Five ways to maximize Java NIO and NIO.2--reference
Java NIO -- the New Input/Output API package-- was introduced with J2SE 1.4 in 2002. Java NIO's purp ...
- Java NIO Files
Java NIO Files Files.exists() Files.createDirectory() Files.copy() Overwriting Existing Files Files. ...
随机推荐
- edis 以及 Python操作Redis
Redis 以及 Python操作Redis Redis Redis是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库. Redis有以下特点: -- Redis支持数据的持 ...
- GitLab如何创建分支及拉取代码
从gitlab地址进入进行操作 1.登录GitLab(账号密码由company统一提供,如果是自己操作的话,就需要先注册) 2.登录gitlab后对已创建好的项目进行分支创建(此处默认项目已创建好,如 ...
- chattr和lsattr命令的使用(对于root用户也无法修改删除的操作问题)
1.chattr命令的用法:chattr [+-=] [ASacdistu] File/Directory 参数说明: +-= :分别为 [+ 增加] [- 减少] [= 设定] 属性的意思 A :当 ...
- (转)C#串口SerialPort常用属性方法
SerialPort(): //属性 .BaudRate;获取或设置波特率 .BytesToRead;得到 接收到数据的字节数 .BytesToWrites;得到送往串口的字节数 .DataBits; ...
- Java 递归详解
递归详解: 1.递归一句话通俗讲就是一个方法自动重复调用自己的过程. 2.因为是重复调用自己了,所以看起来像一个循环,所以为了避免内存溢出系统崩溃,我们需要在方法里加一个返回值判断,用于递归循环的跳出 ...
- gentoo AR9285 BCM57780 安装驱动
首先使用启动光盘启动, 然后 mount /dev/sda4 /mnt/gentoo 挂载硬盘 lspci -v 1>/mnt/gentoo/root/lspci_v.txt 输出信息到文件. ...
- python二进制转换
例一.题目描述: 输入一个整数,输出该数二进制表示中1的个数.其中负数用补码表示. 分析: python没有unsigned int类型 >>> print ("%x&qu ...
- python数组和矩阵使用总结
python数组和矩阵使用总结 1.数组和矩阵常见用法 Python使用NumPy包完成了对N-维数组的快速便捷操作.使用这个包,需要导入numpy. SciPy包以NumPy包为基础,大大的扩展了n ...
- 一个全栈Web/移动App开发学习路径
HTML.CSS 和 JavaScript 网页开发的基本元素,包括HTML.CSS个JavaScript.本课程完全适合零基础的同学,当然如果你有相关开发经验更好.在课程开始呢,我们先探索与讨论HT ...
- std::ios_base::fmtflags orig std::streamsize prec