IO stream summary, io stream
1. File class: used to describe a directory or File in a File system
You can use File to obtain the name, size, and modification date of the File or directory, but cannot access the File content.
For example, create a directory:
File f = new File ("." + File. separator + "aa.txt"); // the File path delimiter depends on the System. "." indicates the current package directory.
System. out. println (f. exists ());
If (! F. exists ()){
Try {
F. createNewFile ();
} Catch (Exception e ){
System. out. println (e. getStackTrace ());
}
}
2. File also provides the list method, which is used to return the array of files or directories in the specified directory.
3. input stream output stream
Byte stream:
InputStream OutputStream
FileInputStream FileOutputStream
BufferedInputStream BufferedOutputStream
Ghost stream
Writer Reader
InputStreamReader OutputStreamWriter
BufferedWriter BufferedReader