1 , clear source and purpose.
Data source: Is required to read, you can use two systems: InputStream, reader;
Data sinks: is required to write, you can use two systems: OutputStream, Writer;
Summarize:
READ: Just read the data into memory
Write: Just read the data.
2 , is the data of the operation plain text?
If it is: Data source: Reader
Data exchange: Writer
If not: Data source: InputStream
Data exchange: OutputStream
Summary: Text-only things with a byte stream, other with the word stream
3 , although a system has been identified, but there are too many objects in the system, which one to use?
Data devices that are explicitly operational.
Data source corresponding device: Hard disk (File), memory (array), keyboard (system.in)
Data sinks correspond to the device: Hard disk (File), memory (array), console (System.out).
4 , do you need to attach additional functionality to the basic operation? like Buffering.
Decorate if you need to.
Operational rules of IO flow in the Java language Learning notes