Get the App
SLTechnology News&Howtos  ›  Development  › 

How to analyze the flow of Java

Shulou Source: shulou.com Published: 2022-06-02 05:57:51 10月02日 Update

This article introduces you how to analyze the flow of Java, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Analysis on the flow of Java

Because there is a project on hand that needs to use Java input and output operation, so, after studying for a few days, I have some understanding of the streaming technology of Java, but there are still a lot of notes that I do not quite understand. Here are some notes that I have read and sorted out. Strictly speaking, they should not be original. I just posted them in the hope of giving you some help.

XML:namespace prefix = o ns = "urn:schemas-microsoft-com:Office:office" / >

1. Java has a complete stream type, with a total of more than 60, and four abstract classes form the basis of these classes.

InputStream and OutputStream read and write single-byte-based byte data streams

Reader and Writer read and write byte data streams based on double-byte Unicode characters

2. Read and write binary data

DataInputStream and DataOutputStream

Can read and write to all basic Java types

FileInputStream and FileOutputStream

The input and output processing of the data stream involved in a disk file is a byte-level read and write operation.

3. There are two types of Java streams according to their responsibilities:

(1) read byte data from a file or some special place (such as FileInputStream)

(2) assemble these byte data into more useful data types (such as DataInputStream, PrintWriter)

To complete the specific operation, the stream needs to be assembled.

4. The stream of Java does not have the functions of pre-reading and buffering, so it needs extra processing.

BufferInputStram buffers the stream

PushbackInputStream pre-read the stream

5. RandomAccessfile random access files, this class implements both DataInput and DataOutput

6. Text stream, that is, the content of a file that can be identified by the human eye through the tools of the host environment.

Because the string writing of windows is in ASCII format, the Unicode encoding is written into a text file, and the contents of the file cannot be recognized by the human eye with the tools of the host environment. Java provides a set of stream filters to make up for the gap between Unicode coding and character coding adopted by the native operating system.

7. InputStreamReader's special encoding scheme converts the input byte stream to Unicode characters; this class adopts the host default encoding and uses ISO 8859-1 encoding, or "ASNI" encoding, in windows.

OutputStreamWriter converts Unicode character streams into special encoding scheme byte streams

8. FileReader and FileWriter

Reading and writing disk files has made up for the gap between Unicode coding and native coding, and can be used directly.

9. Write text output:

Binary write data: DataOutputStream

Write data in text format: PrintWriter

Read text input:

Binary read data: DataInputStream

Read data in text format: BufferReader

10. Other streams

Such as: ZipInputStream and ZipOutputStream

On how to analyze the flow of Java to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Data encoding byte file text processing content character type input special host binary basic data flow format convection help output human eye Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux vpn Docker Huawei NVidia