First, Javase (21) character stream, Io flow summary, case

Source: Internet
Author: User

1: Character Stream (mastering)

(1) Byte stream operation Chinese data is not particularly convenient, so there is a conversion stream.

The function of the conversion stream is to use the byte stream to convert the character stream.

(2) The conversion stream is actually a character stream

Character stream = byte stream + encoding table

(3) Coding table

A: A table consisting of characters and corresponding values

B: Common Coding tables

Ascii

Iso-8859-1

GB2312

GBK

GB18030

UTF-8

C: Encoding issues in strings

Coding

String--byte[]

Decoding

Byte[]--string

(4) Coding problems in IO stream

A:outputstreamwriter

OutputStreamWriter (outputstream OS): Default encoding, GBK

OutputStreamWriter (OutputStream OS, String CharSet): Specifying encoding

B:inputstreamreader

InputStreamReader (InputStreamReader is): Default encoding, GBK

InputStreamReader (InputStreamReader is,string CharSet): Specify encoding

C: The coding problem is actually very simple

As long as the code is consistent

(5) Character stream

Reader

|--inputstreamreader

|--filerreader

|--bufferedreader

Writer

|--OutputStreamWriter

|--filewriter

|--bufferedwriter

(6) Copy the text file (5 ways)

2:io Flow Summary (master)

IO stream

|--Byte stream

|--byte input stream

InputStream

int read (): reads one byte at a time

int read (byte[] bys): reads one byte array at a time

|--fileinputstream

|--bufferedinputstream

|--byte output stream

OutputStream

void write (int by): Write one byte at a time

void Write (byte[] bys,int. index, int len): Write one 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) reads one character array at a time

|--inputstreamreader

|--filereader

1--bufferedreader

String ReadLine (); read one string at a time

|--character output stream

Writer

void write (int ch): Write one character at a time

void Write (Char[]cha, int index,int1en): writes one part of a character array at a time

|--outputstreamwriter

|--filewriter

|--bufferedwriter

void newline (): Write a line break

void write (string line): Write one string at a time

3: Case study (comprehension exercise once again)

A: Copy A text file 5 ways (Master)

B: Copy Picture (binary stream data) 4 ways (Master)

C: Store the data in the collection into a text file

D: Reading data from a text file into a set merge traversal collection

E: Copy single-level

F: Copy the file specified in the single-level folder and modify the name

Review the bulk modification name

G: Copy Multilevel folders

H: Keyboard entry Student information stored in a text file from high to low score

I: Sort the strings in a file and output them to another text file

J: Using reader to simulate the unique functions of BufferedReader

K: Unique features of analog LineNumberReader

First, Javase (21) character stream, Io flow summary, case

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.