C # language using fundamental class FileStream

 

FileStream class is not static class, you need to create objects to use, FileStream class can both read text files can also be written for multimedia files, read and write in the form of a byte array, used to read and write large files, the difference in the file class is that it can be carried out step by step to read and write files, reduce memory pressure, the disadvantage is that we need to manually shut down and release resources,

1, FileStream common method

     FileStream class constructor;

 

          public FileStream(string path, FileMode mode, FileAccess access);

                path:
                        The current package FileStream object relative or absolute path of the file path.
                mode:
                        a constant that determines how to open or create the file.
                access:

                        A constant for determining FileStream object access files.

  Method FileStream class;

 

            public override int Read(byte[] array, int offset, int count);

            public override void Write(byte[] array, int offset, int count);

FileStream write operation is not entirely overwrite the original file, but how much coverage the original file with the number of bytes, while the File class is written completely overwrite the original file

FileStream step to read and write large files

 

Guess you like

Origin www.cnblogs.com/ljs7490/p/11007464.html