Summary of IO flow in Java learning

Source: Internet
Author: User

---restore content starts---

Stream is used to read and write data, Java has a class called file, it encapsulates the files of the file name, just an object inside the memory, the real file is a section on the hard disk, in this file contains a variety of data, we want to read the data in the file what to do? is through a stream of the way to read, I want to read from the program data, for the computer, no matter what type of data read is 01010101010101 such a form of reading, how to read the data inside the file? You can think of the file as a small bucket, the file is a bucket, the data in the file is equivalent to the water inside the bucket, then how can we get water from the bucket, that is, how to read from this file data.

The common way to get water is that we use a pipe into the bucket above, and then open the faucet on the other side of the pipe, the water in the bucket begins to flow out of the faucet, the water in the bucket is flowing through this pipe, so this is called flow with the pipe, and the flow input/output in Java is the same as the principle of flow When you want to read data from a file, a pipe inserted into the file, and then the data inside the file out of the pipeline, then you can read from the other end of the pipeline from the file flow out of a variety of data, when you want to write data to the file, but also through a pipeline, sometimes the flow will exist Point magazine, We need to wrap a layer of pipe outside the pipeline to remove the magazine, from the point of view of the program, the original data read from the computer must be 010101 such a form, a byte of a byte to the outside to read, when you read this is not appropriate, you can set a more powerful pipe outside the pipeline, This pipeline converts 01010101 into a string output.

Ii. input and output stream classification

---restore content ends---

Summary of IO flow in Java learning

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.