Java Learning Note IO One ()

Source: Internet
Author: User

1. Buffered input File

2. Input from memory

3. Formatted memory input

4. Basic Text Output

Example:

public class Brandbworpwdemo {public    static void Main (string[] args) throws ioexception{         //Read and write         to file BufferedReader br = new BufferedReader (new                InputStreamReader (                        new FileInputStream ("E:\\javaio\\imooc.txt")) );        /*bufferedwriter bw = new BufferedWriter (new                outputstreamwriter (                        new FileOutputStream ("e:\\javaio\\ Imooc3.txt "))); * *
PrintWriter pw = new PrintWriter ("E:\\javaio\\imooc4.txt");// //printwriter PW1 = new PrintWriter (OutputStream, Boolean autoflush); String Line; while (lines = Br.readline ())!=null) { System.out.println (line);//read one row at a time, and do not recognize the newline /*bw.write (line); Write the line-break operation separately bw.newline ();//newline Operation Bw.flush (); */ Pw.println (line) ; Pw.flush (); } Br.close (); Bw.close (); Pw.close (); }}

  

Java Learning Note IO One ()

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.