The rule summary of IO Flow: The problem to be solved is the problem of which stream object should be used in the development.
1, clear data sources, data sinks (data purposes)
In fact, it is in the explicit IO system to be used: Byte stream InputStream & OutputStream, character stream Reader & Writer
The requirement is the source of action: it means reading, InputStream & Reader
Purpose of operation in demand: meant to be written, OutputStream & writer
2, is it clear that the manipulated data is plain text?
Yes, select the character stream object.
No, select the byte stream object.
Yes and is the source. Reader object and sub-class
Is and is also the purpose, writer object and sub-class
The first two clear, clear the specific to use the system.
The next step should be to identify which object to use in the specific system.
3, clear the specific equipment to operate. Each device has a corresponding stream object.
Source Device:
Hard disk, the stream object that can manipulate file is. File begins.
Keyboard, system.in;
Memory, Array.
Network, Socket stream.
Purpose Equipment:
Hard disk, the stream object that can manipulate file is. File begins.
Display, System.out
Memory, Array.
Internet. The socket stream.
A specific flow object can be found in the third step.
4. Do you need extra functionality?
Do you need to be efficient? Buffer, beginning with buffered.
Do you need an encoding conversion? Convert the stream.
2017-12-30 content to autobiographical intelligence podcast
Summary of Java I/o---