Mobile development BufferedReader/BufferedWriter parsing,

Source: Internet
Author: User

Mobile development BufferedReader/BufferedWriter parsing,
FileWriter/FileReader

The file byte stream is connected to the encoding conversion stream"

FileWriter out = new FileWriter (File );

Equivalent

OutputStreamWriter out = new OutputStreamWriter (new FileOutputStream (File ))

Cannot be converted to the specified Encoding

BufferedReader/BufferedWriter

Byte Buffer
Create object
BufferedWriter out = new BufferedWriter (connected to the bytes Stream)

Method
BufferedReader
ReadLine ()
Read a line of string, excluding the end line break
Return null after reading

Chestnuts

Public static void main (String [] args) throws Exception {// The character stream that is connected to each other. encode and convert all the characters to be read. // you only need to use the character stream, the conversion stream BufferedReader in = new BufferedReader (new InputStreamReader (new FileInputStream ("d:/abc/f7"); String line; while (line = in. readLine ())! = Null) {System. out. println (line) ;}in. close ();}

Output result

Abc Chinese

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.