IO:
java.io.File class using
IO principle and stream classification
File stream:
FileInputStream / FileOutputStream
FileReader / FileWriterBuffered
stream:
BufferedInputStream / BufferedOutputStream
BufferedReader / BufferedWriterConversion
stream:
InputStreamReader / OutputStreamWriterStandard
input/output streamPrint
stream:
PrintStream / PrintWriter
Data Stream:
DataInputStream / DataOutputStream
Object Stream: -- involves serialization, deserialization
ObjectInputStream / ObjectOutputStream
Random Access File Stream:
RandomAccessFile
java.io.File class: abstract representation of file and directory pathnames, independent of platform
File can create, delete, and rename files and directories, but File cannot access the file content itself. If you need to access the file content itself,
you need to use the input/output stream
File object can be passed as a parameter to the constructor of the stream
IO stream
concept: used to handle data transfer between devices.
Principle: The input/output of data in Java programs is carried out in the form of streams. The
java.io package provides various stream classes and interfaces to obtain different data and input them through standard methods. Or output data
1> According to the flow of data flow:
input input: read external data (data from storage devices such as magnetic disks, optical discs, etc.) into the program (memory).
Output: Output the data in the program (memory) to storage devices such as disks and CDs.
2>According to different data units:
①Byte stream (8bit)
②Character stream (16bit)
3>According to the different roles of the stream, it is divided into: ①Node
stream:
FileInputStream, FileOutputStream (byte stream)
FileReader, FileWriter (character stream)
②Processing streams
/*
* 1. Classification of streams:
* According to different flow directions: input stream, output stream
* According to different processing data units: byte stream, character stream (processing text files)
* According to different roles: node stream (The program acts directly on the file), processing stream
* IO system:
* Abstract base class Node stream (file stream) Buffered stream (a kind of processing stream) Tested: use the same video file to copy, use the buffered stream to speed up about 67%
* InputStream FileInputStream BufferedInputStream
* OutputSteam FileOutputStream BufferedOutputStream (flush())
* Reader FileReader BufferedReader
* Writer FileWriter BufferedWriter (flush())
*/
IO stream based on java
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326891655&siteId=291194637
Recommended
Ranking