Learning content summary
- class file: three constructor: File (String filename); File (String directoryPath, String filename); File (File dir, String filename)
- File input stream of bytes:
- Four basic steps:
- Setting input stream source
- Create a link to the source of the input stream
- Let the input data stream read from the source
- Close the input stream
- Use
FileInputStream(String name);
FileInputStream(File file);
to create an input stream - Output stream: a character input stream and output stream read and write methods using a character array to read data
- Scanner class parses the file:
- Use the default file parsing division marks
- Use regular expressions to parse the file as a separate tag
File file = new File("hello.java");
Scanner sc = new Scanner(file);
File file = new File("hello.java");
Scanner sc = new Scanner(file);
sc.useDelimiter(正则表达式);
Other (perception, thinking, etc.)
no
Reference material
- "Java Programming"