In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the buffering thought in the IO stream. The explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the buffering thought in the IO stream.
Buffer idea (because the operation speed of the memory is much faster than the original acid speed of the hard disk, so as long as you reduce the number of read and write times of the hard disk, you can improve the efficiency.)
1. The speed of byte stream reading and writing an array at a time is much faster than that of reading and writing one byte at a time.
two。 This is a buffer effect such as adding an array, and the java itself is designed at the time
3. Also taking into account this design idea (explained later in the decorative design pattern), a byte buffer stream is provided.
BufferedInputStream
1. BufferedInputStream has a built-in buffer (array)
two。 When reading a byte from BufferedInputStream
3. BufferedInputStream will read 8192 files at once, store them in the buffer, and return one to the program.
4. When the program reads it again, it doesn't have to look for the file and gets it directly from the buffer.
5. Do not re-read 8192 from the file until everything in the buffer has been used
BufferedOutputStream
1. BufferedOutputStream also has a built-in buffer (array)
two。 When a program writes bytes to the stream, it does not write directly to the file, but to the buffer first.
3. Until the buffer is full, BufferedOutputStream will not write the data in the buffer to the file at once.
Thank you for your reading, the above is the content of "buffering thought in IO flow". After the study of this article, I believe you have a deeper understanding of the buffering thought in IO stream, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.