Java BASICS (20) IO streams (3) and java basics io streams

Source: Internet
Author: User

Java BASICS (20) IO streams (3) and java basics io streams

Here are some of the knowledge points and code I summarized in my previous class. Most of the notes I think are very good and classic, sincerely hope that these will help those who want to learn!

It is inconvenient to upload code by module. There are also many things, and they are also clear! If you need it, you can leave your email in the comments. I will certainly send it to you for free! Thank you for making progress on this platform !! Remember that programmers are selfless !!!

Also very welcome to my blog to watch blog address: http://www.cnblogs.com/duscl/

 

/* 1: bytes stream (master) (1) It is not very convenient to operate Chinese data in byte streams, so a conversion stream is displayed. The role of the conversion stream is to convert the byte stream to the upstreaming stream. (2) Conversion stream is actually A two-byte stream = byte stream + encoding Table (3) encoding Table A: A table B consisting of characters and corresponding values: common coding table ASCII ISO-8859-1 GB2312 GBK GB18030 UTF-8 C: encoding problem in String encoding String -- byte [] decoding byte [] -- String (4) encoding problem in IO stream: outputStreamWriter (OutputStream OS): default encoding. GBK OutputStreamWriter (OutputStream OS, String charsetName): Specifies the encoding. B: InputStreamReader (InputStream is): default encoding, GBK InputStreamReader (InputStream is, String charsetName): Specifies the encoding C: encoding is actually very simple, as long as the encoding is consistent (5) stream Reader | -- InputStreamReader | -- FileReader | -- BufferedReader Writer | -- OutputStreamWriter | -- FileWriter | -- BufferedWriter (6) Copying text files (5 methods) 2: IO stream Summary (master) IO stream | -- byte input stream InputStream int read (): read one byte int read (byte [] bys) at a time ): read a byte array at a time | -- FileInputStream | -- BufferedInputStream | -- output byte stream OutputStream void write (int by): write a byte void write (byte [] bys, int index, int len): Write a part of a byte array at a time. | -- FileOutputStream | -- BufferedOutputStream | -- character stream | -- character input stream Reader int read (): read one character at a time int read (char [] chs): read one character array at a time | -- InputStreamReader | -- FileReader | -- BufferedReader String readLine (): read a string at a time | -- character output stream Writer void write (int ch): write a character at a time void write (char [] chs, int index, int len ): write a part of a character array at a time | -- OutputStreamWriter | -- FileWriter | -- BufferedWriter void newLine (): write A linefeed void write (String line): write a String at a time. 3: case Study (understanding exercises once) A: copying text files in five ways (master) B: copying images (binary stream data) 4 ways (master) C: store the data in the set to the text file D: Read the data in the text file to the set and traverse the set E: copy the single-level folder F: copy the specified file in the single-level folder and modify the name. Review the batch modification name. G: copy the multi-level folder. H: Enter the student information on the keyboard and store the information from high to low to the text file. I: sort the strings in a file and output them to another text file. J: Use Reader to simulate the special function of BufferedReader. K: to simulate the special function of LineNumberReader *\

 

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.