J2SE basics: 12. IO stream Programming
Inheritance System:
1: byte stream
All streams ending with streams are byte streams. Byte streams are used to read binary data.
2: Ghost stream
All ends with reader/writer.
Write
Append (char c): Write character
Write (char [] cbuf)
Write (String str)
Write (int c)
Flush ()
Close ()
FileWrite (); used to operate files.
BufferWriter ();
Stream with buffer
NewLine (): enter a line break.
Reader
FileReader
BufferReader
ReadLine ();
3: note the following when using word throttling and text streaming:
1: byte streams and byte streams are read by one byte or one character by default.
2: If a byte array or character array is used, remember to control the number of bytes or characters that are last read.
3: if low-level and advanced streams are used, close the advanced stream first, and then close the low-level stream.
Conversion between byte stream and byte stream
InputStreamReader: converts a byte input stream to a character input stream.
OutputStreamWriter: converts byte output into character output streams.
InputStremReader: belongs to the bytes stream.
How to Use stream to read configuration files
Configuration file:
Write the dynamically changed data in the program into the file, and the program dynamically obtains the content in the file.
This type of file is the configuration file.
Ini:
Properties:
XML: