Java 21-15 new IO stream NIO

Source: Internet
Author: User

1:JDK4 New IO classes to understand

Buffer (buffered), Channer (channel)

2:jdk7 New IO classes to know

Path: Platform-independent paths.

Paths: Contains a static method that returns path.

public static path Get (URI uri): Determines the file path based on the given URI. Files: The tool class for manipulating files. Provides a number of ways to

Learn the following simple ways

public static long copy (Path source, outputstream out): Copy file

public static Path Write (path path, iterable<? extends charsequence> lines, Charset cs, openoption ... options): Sets the Data is written to a file.

 1  //  2  files.copy (Paths.get ("Demo.java"), Newfileoutputstream (" Copy.java " 3  //   write the data in the collection to a file  5  list<string > list = new  arraylist<string> ();  6  list.add ("Hello" );  7  List.add ("World"  8  list.add ("java"  9  Files.write (Paths.get ("List.txt"), List, Charset.forname ("GBK")); 

Java 21-15 new IO stream NIO

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.