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