Talking about the input and output stream of Java

Source: Internet
Author: User

The input and output capabilities of the Java language are very powerful and flexible, and the drawback is that the code that looks like input and output is not very concise, because you often need to wrap many different objects. In the Java class Library, the IO part of the content is very large, because it involves a wide range of areas: standard input and output, file operations, network data flow, string flow, object flow, zip file flow .... The purpose of this article is to give you a brief introduction.

Flow is a very graphic concept, when the program needs to read data, it will open a stream to the data source, this data source can be file, memory, or network connection. Similarly, when a program needs to write data, it opens a stream to the destination. At this point you can imagine that the data seems to be moving in this way, as in the following figure:

There are two kinds of streams in Java, one is the byte stream, the other is a stream of characters, which is represented by four abstract classes (each stream includes input and output, so altogether four): Inputstream,outputstream,reader,writer. Other streams of varying variations in Java are derived from them:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.