Java notes: Non-blocking I/O

Source: Internet
Author: User

First, the basic knowledge

Java provides another set of buffer-oriented, channel-based I/O systems that represent connections that open to I/O devices.

The path interface encapsulates the file path and provides a number of ways to manipulate the path.

The files class provides a static method for file operations, using path to specify the path.

Second, the basic operation

Read and write files through channels.

View Code

By mapping files to buffer read-write files, buffers automatically read files or write to files.

View Code

Copy the file.

View Code

Stream-based usage.

View Code

Iii. path-and file-system-based operations

Get file-related information.

View Code

Lists the contents of the catalog.

View Code

Filter the contents of the catalog.

View Code

Lists the directory tree. The implementation of the Filevisitor interface determines how the directory tree is traversed, and filevisitor-defined methods return Filevisitresult enumeration objects.

    • CONTINUE: Continue traversing the directory.
    • TERMINATE: Stop traversing the directory.
    • Skip_sublings: Skips the current directory and its sibling directory.
    • Skip_subtree: Skips the current directory.
View Code

Java notes: Non-blocking I/O

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.