NIO and IO in the java file system, and nioio in the java File System
Java introduced the java NIO mechanism since jdk1.4:
The notable features of NIO are channel, buffer, selector ), n
First, the concept
NiO is the new IO, the library is introduced in JDK1.4. NiO and IO have the same effect and purpose, but the implementation is different, NIO is mainly used in blocks, so the efficiency of NIO is much higher than IO. Two sets of NIO are provided in the
Introduction to Java NIOI/OI/O or input and output refers to the interface between the computer and the outside world or between a program and the rest of the computer. It is critical for any computer system, so the body of all I/O is actually built into the operating system. Separate programs generally allow the system to do most of the work for them.In Java programming, I/O has been completed until recent
Java NiO and Io
After learning the Java NIO and IO APIs, a problem flooded into my mind:
When should I use IO and when to use NIO? In this article, I'll try to clearly parse the differences between Java
Java NiO (new IO) is also a new feature introduced in JDK 1.4. Another important feature of JDK 1.4 is that regular expressions are often used, but NiO may be used, probably because the old Io system is still enough. For example, jdk1.5 has long been generic and annotated, but it is impossible to practice generics and annotations for various reasons.
The above mainly explains the Java IO class and how to use it, this article mainly about the NIO principle.NiO principleBlocking IONon-blocking and blocking is what we often call Io and nio. Before we talk about non-blocking, let's take a look at the blocking in the network communication.Common network IO communication flowsAbove is a network communication IO flo
The BufferedReader described in http://my.oschina.net/u/2263278/blog/508770 refers to one of its characteristics----when BufferedReader reads data from the input stream, if no valid data is read , where the program will block execution of the thread (using the Read () method of InputStream to fetch data from the stream, it will block the thread if there is no data in the data source), that is, the input stream described earlier, the output stream is blocked input, output. The traditional input a
Original address: http://tutorials.jenkov.com/java-nio/nio-vs-io.htmlauthor : Jakob Jenkov translator : Guo proofreading: Fang FeiAfter learning the APIs for Java NIO and Io, a problem immediately poured into my mind:When should I use IO and when do I use
After learning the Java NIO and IO APIs, a problem flooded into my mind:
When should I use IO and when to use NIO? In this article, I'll try to clearly parse the differences between Java NiO and Io, their usage scenarios, and how they affect your code design. The main diffe
In JDK, there is a very interesting Library: NiO (New I/O ). This library has three important classes: Selector and channel in Java. NiO. channels and buffer in Java. NiO.
This articleArticleFirst, let's take a look at why NiO i
ProgrammingThe java.nio.* package in JDK 1.4 introduces a new Java I/O library, which is designed to increase speed. In fact, "old" I/O packages have been re-implemented using NIO, which can benefit even if we don't explicitly use NIO programming. The increase in speed can occur in both file I/O and network I/O, but this article discusses only the latter.2.1. In
Transferred from: http://blog.csdn.net/keda8997110/article/details/19549493After learning the APIs for Java NIO and Io, a problem immediately poured into my mind:When should I use IO and when do I use NIO? In this article, I'll try to clearly parse the differences between Java NiO
Java uses NIO to establish a Socket server
The Socket Channel registers an action on the Selector. The Selector uses the select action to monitor the actions of all the channels registered with the Selector. If a corresponding action is detected, the return value is selectedKeys, and each SelectionKey is obtained manually for processing. Of course, NIO can not on
when should I use IO , when to use NIO it? In this article, I'll try to clearly parse the differences between Java NIO and IO , their usage scenarios. And how they affect your code design. Java NIO and the IO The main differenceThe following table summarizes
first, the conceptNiO is the new IO, which was introduced in JDK1.4. NiO and IO have the same function and purpose, but the way of implementation is different, NIO is mainly used in blocks, so the efficiency of NIO is much higher than IO. Two sets of NiO are available in the Java
idling.NIO uses reactor mode, a reactor thread aggregates a multiplexer selector, which can register, listen, and poll hundreds of channel simultaneously, an IO thread can concurrently handle N client connections simultaneously, and the threading model is optimized to 1:N (N Java NIO is not synchronous non-blocking I/O, why does Java
constraints, the full use of CPU and memory potential, is the core content of performance optimization.And how is CPU and memory dragged down by IO? This starts with several typical IO operating modes in Java.Ii. Typical IO operation mode in Java 2.1 synchronous blocking modeThe bio-style API in Java is the pattern, for example:Socket socket =// cannot read data vow not to returnIn this mode, the most intu
to improve the performance of network I/O and hard disk I/O operations. There are three new features in NIO:1. data Buffer processing (bytebuffer): Because the original data communication type between the operating system and the application is byte, it is also the basic unit of Io data operations. In NiO, every basic native type (except Boolean) has buffer implementation: charbuffer, intbuffer, doublebuff
A lot of people who have just come in contact with NIO have the first glimpse of a relatively obscure Java API, such as Channel,selector,socket or something; and then there's a bunch of hundreds of lines of code to demonstrate the service-side demo of NiO, so here's a user-friendly introduction.
NiO we generally think
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.