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. ...
随机推荐
- (一)apache atlas源代码编译与打包
特别注意: atlas已经提供了0.8版本可以安装了,只有在国外的服务器上安装编译才比较顺利,可以按照官方文档去安装. 国内很多网址有被墙的问题,目前还没有完全解决,可能安装不成功 安装文档地址:ht ...
- c++ maps使用
#include <iostream> #include <stdio.h> #include <memory.h> #include <queue> ...
- 关于thinkphp中post提交空白的思考
关于thinkphp中post提交空白的思考 首选检查 目标路径是否存在 如果目标URL不存在 那肯定是空 如果提交的路径存储 TP这种完善的系统肯定会提示 各种报错了
- mysqld服务启动失败, Failed to restart mysqld.service: Unit not found.
-bash-4.2# service mysqld restart Redirecting to /bin/systemctl restart mysqld.serviceFailed to rest ...
- [配置]给Myeclipse配置Tomcat
http://jingyan.baidu.com/article/4853e1e53465271909f72690.html 步骤 1 2 3 4 5 6 7 8 Meclipse是java We ...
- kubectl version报did you specify the right host or port
现象: [root@localhost shell]# kubectl version Client Version: version.Info{Major:", GitVersion:&q ...
- windows 运行hadoop的WordCount报nativeio.NativeIO$Windows.createDirectoryWithMode0(Ljava/lang/String;I)
window eclipse连接hadoop集群,本地运行wordcount,报以下错误,尝试网络上的方法无果,如:换64JDK,添加hadoop_home,path,以及在hadoop\bin和c: ...
- vue-router 动态导航 router-link :to属性
经常碰到这类需求,从后台获取数据后再前程连接,参数id动态获取 <el-row v-for="item in Travels"> <el-col :span=&q ...
- mac 关于默认python2下的pip,和python3下pip 的坑
pip是常用的python包管理工具,类似于java的maven.用python的同学,都离不开pip. 1.在Python2.7的安装包中,easy_install.py是默认安装的,而pip需要手 ...
- react-native 安卓支持 gif动态图
需要在android/app/build.gradle文件中添加模块 //这一行没有的话得加上才行 compile "com.facebook.fresco:fresco:1.5.0&quo ...