1. You can refer to the previously written notes: Android (Java) Learning Note 167:java The class description of the action file (file + IO stream)
2. FileOutputStream (Common) method of construction:
FileOutputStream(File file)
Constructs a new fileoutputstream on the File file
.
FileOutputStream(String filename)
Constructs a new fileoutputstream on the file named filename
.
3. code example:
1 PackageCom.himi.fileoutputstream;2 3 ImportJava.io.File;4 Importjava.io.FileNotFoundException;5 ImportJava.io.FileOutputStream;6 7 /*8 * 9 * Construction method excerpt:Ten * FileOutputStream (String filename) One * Constructs a new fileoutputstream on the file named filename. A * - * FileOutputStream (file file) - * Constructs a new fileoutputstream on the file file. the * - */ - - Public classFileoutputstreamdemo { + - Public Static voidMain (string[] args)throwsFileNotFoundException { + // fileoutputstream (file file) AFile File =NewFile ("Fos.txt"); atFileOutputStream fos =Newfileoutputstream (file); - - // fileoutputstream (String filename) -FileOutputStream FOS1 =NewFileOutputStream ("Fos.txt"); - - } in -}
Java basic Knowledge Hardening IO Flow Note 17:fileoutputstream construction method using