Java Core Class Library-io-nio overview

Source: Internet
Author: User

Nio:new IO

Starting with JDK1.4, the new IO, which can map a disk file into memory, we then read the data in memory.

stored in the Java.nio package

Java NIO (new IO) is a new IO API introduced by the Java1.4 version, which can replace the standard Java IO API, which is now primarily used in servers, and is sufficient for us to write code that still uses traditional IO.

Java NiO provides a different way of working with iOS than standard IO:

Channels and buffers (channels and buffers): Standard IO is based on byte stream and character stream, and NiO is based on channel (channels) and buffers (buffer), and the data is always read from the channel into the buffer. or write from the buffer to the channel.

Asynchronous (Asynchronous IO): Java NIO allows you to use IO asynchronously, for example: When a thread reads data from a channel to a buffer, the thread can do something else. When the data is written to the buffer, the thread can continue to process it. Writing a channel from a buffer is similar.

Selectors (selector): Java NiO introduces the selector concept, which is used to listen for events on multiple channels (e.g., link open, data arrival). Therefore, a single thread can listen to multiple data channels.

Java Core Class Library-io-nio overview

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.