1. Overview of common Java I/O classes
2. file reading and writing
You can choose to use FileInputStream (FileOutputStream) or FileReader (FileWriter) depending on whether the file is a binary file or a text file.
These classes allow you to read one byte or character at a time from the beginning of a file to the end of a file, or write a read to a byte array or an array of characters. Instead of reading the entire file at once, you can sequentially read the bytes and characters in the file.
If you need to read some parts of a file in a jump, or if you want to write at the same time, you can use Randomaccessfile.
You may need to read the file's information instead of the contents of the file, such as file size, attributes, and file list under Folders, you can use file.
3. Piping
The pipeline in Java IO provides the ability to communicate with two threads running in the same JVM.
You cannot use pipelines to communicate with threads in different JVMs (different processes). Conceptually, the Java pipeline differs from the pipeline in the Unix/linux system. In Unix/linux, two processes running in different address spaces can communicate through a pipeline. In Java, both sides of the communication should be different threads running in the same process.
Java I/O notes