Summary of Javaio flow operation law

Source: Internet
Author: User

operation Law of Io flow object

For the operation of IO flow, the development needs to be clear 4 purposes;

1. Clear Source and purpose (sinks);

Source: InputStream Reader

Purpose: OutputStream Writer

2. Clear whether the data is plain text

Source: Is plain text: Reader

No inputstream

Purpose: A plain text Writer

No OutputStream

Here you can identify which system is specifically used in the requirements.

3. Identify specific equipment

SOURCE Device:

Keyboard: System.in

Hard disk: File

Memory: Array

Network: Socket stream

Target device:

Monitor (console): System.out

Hard disk: File

Memory: Array

Network: Socket stream

Identify specific objects

4. Whether additional features are required

1. Need for greater efficiency (buffer)

Yes, just join buffer.

2. Whether temporary storage is required

3 .....


In a character operation, if you need to explicitly specify the encoding table, you must use a transform stream to set the encoding table. You can only use OutputStreamWriter when you export to a file. FileWriter uses the system's default character encoding table.


The transformation rule of Io stream:

InputStreamReader: A byte-to-character bridge. Decoding

OutputStreamWriter: The character-to-byte bridge. Coding

Learn to perform requirements analysis and dismantle requirements.


Summary of Javaio flow operation law

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.