File Store--io operation files
Openfileoutput, Openfileinput
The context provides the following two ways to open the file IO stream inside the data folder of this application.
1.FileInputStream openfileinput (String name): Opens the name file under the Data folder in the application corresponding to the input stream
2.FileOutputStream openfileoutput (String name,int mode): Open the output stream corresponding to the name file under the application's data file
Attention:
The mode parameter in FileOutputStream openfileoutput (String name,int mode) is used to specify the pattern of open files, supported by the following modes:
1.mode_private: Changes to the file can only be read and written by the current program;
2.mode_append: Opens the file in an additional way, and the application can append the content to the file;
3.mode_world_readable: The contents of the file can be read by other programs (read only);
4.mode_world_writeable: The contents of the file can be read and written by no other program;
In addition, the context also provides the following two ways to access the application's Data folder.
1.getDir (String name,int mode): Gets or creates a subdirectory of name in the application's Data folder;
2.File Getfilesdir (): Gets the absolute path of the data folder for the application;
3.string[] FileList (): Returns all files under the Data folder of the application;
4.deleteFile (String): Deletes the file specified under the Data folder of the application;
Examples are as follows:
Android Learning Note 46--file Storage