Java input and output and file reading and writing (2)

                                   Java input and output and file reading and writing (2)

 

Reference books: Java programming foundation -- Chen Guojun

 

The previous blog explained and demonstrated the java input and output and file reading and writing conceptually. This article mainly explains the hierarchical relationship of java input and output stream classes.

In the figure below, the inheritance relationship of each class can be clearly seen according to the indentation, which is similar to the file indentation hierarchy of the project.

java.lang.Object

InputStream (byte input stream class)

FileInputStream (file byte input stream class)

PipedInputStream (pipe byte input stream class)

FilterInputStream (filter byte input stream class)

BufferedInputStream (buffered input stream class)

LineNumberInputStream (line number byte input stream class)

PushbackInputStream (pushback input stream class)

DataInputStream (data input stream class)

SequenceInputStream (sequential input stream class)

OutputStream (byte output stream class)

FileOutputStream (file byte output stream class)

PipedOutputStream (pipe byte output stream class)

FilterOutputStream (filter byte output stream class)

BufferedOutputStream (buffered output stream class)

DataOutputStream (data output stream class)

PrintStream (print output stream class)

Reader (character input stream class)

PipedReader (pipe character input stream class)

BufferedReader (buffered character input stream class)

LineNumberReader (line number character input stream class)

FilterReader (filter character input stream class)

InputStreamReader (character input stream class)

FileReader (file character input stream class)

StringReader (string input stream class)

Writer (character output stream class)

PipedWriter (pipe character output stream class)

BufferedWriter (buffered character output stream class)

FilterWriter (filter character output stream class)

OutputStreamWriter (character output stream class)

FileWriter (file character output stream class)

StringWriter (string output stream class)

File (file stream class)

RandomAccessFile (random access file class)

 

InputStream, OutputStream, Reader, Writer, etc. are all abstract classes, so generally speaking, these classes are not used directly, because it is impossible to indicate which I/O device they correspond to. Usually files are processed according to the word classes derived from these classes, because these word classes correspond to specific I/O devices.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326818047&siteId=291194637