1. Flow type system:
Base stream Adorner flow wrapper class helper class
2. Stream
file~ memory~ network~
Stream is an abstract class in which the method is either abstract or virtual
3. Adorner flow : inherits from the Stream class and contains a reference to the Stream class. such as BufferedStream GZipStream
The purpose of Adorner mode: To add functionality to an existing class.
4. wrapper class : Note The class, not the stream. That is, they are not stream types but contain a reference to the stream, providing an easy way to manipulate the convection.
Used to read the contents of a file.
The TextReader TextWriter is a base class that is independent of the stream and defines the way in which character data is read and written.
StreamReader Streadwriter is a subclass. StreamReader: Reads the contents of the stream as characters. Streamwrite writes a character to the stream.
Stringreader,stringwirte is also a subclass, but it just reads and processes the string without processing the stream.
string [email protected] "Product: Lumia 920 Price: 4998"; StringReader reader=new StringReader (text); int c =reader.read (); Console.Write ((char) c); Output: Production char[] buffer=new char[8];rader.read (buffer,0,buffer.length); Console.Write (String.Join ("", buffer));// Product: Lumia //Assume that the text string above is saved in the file as long as the Stringreder is replaced with Streamreaderfilestream fs=new filestrem (...); StreamReader reader=new StreamReader (Fs,encoding.getencode ("GB2312"));
Encoding method: All involved in text files must have coding problems. The encoding defines how the bytes are converted into readable characters or text. It can be imagined that the corresponding relational table of bytes and characters.
5. The Help class is not very close to the flow, but it can make the file stream operation simple.
File FileInfo Path Directory Diretoryinfo
FileStream fs=file.create ("1.txt");
NET Intermediate Class--file, stream, serialization 2