Java of Java io. File related methods
java. io. Use of file.
IO principle and stream classification.
File stream: FileInputStream, fileoutputstream, FileReader, filewriter
Cache stream: bufferedinputstream, bufferedoutputstream, BufferedReader, bufferedwriter
Conversion stream: inputstreamreader, ouputstreamreader
Standard input / output stream
Print stream
data stream
Object stream: involves serializing and deserializing objectinputstream and objectoutputstream
Random access file stream: randomacessfile
java. io. File class: an abstract representation of file and directory pathnames, which is platform independent.
File can be created, deleted, @ r_ 419_ 2452 @ files and directories, but file cannot access the file content itself. If you need to access the file content itself, you need to use input / output streams.
The file object can be passed as a parameter to the constructor.
Common construction methods of file class:
Access file name:
File detection:
Get general file information:
File operation related:
Directory operation related:
Recursively judge whether the file under a folder is a folder or a file.
Output:
F: \ test is the folder F: \ test \ file1 is the folder F: \ test \ File2 is the folder F: \ test \ file3 is the folder F: \ test \ file4 is the folder F: \ test \ test1 Txt is the file f: \ test \ test2 Txt is the file f: \ test \ test3 Txt is the file f: \ test \ test4 Txt is a file