Any tutorial to understand Streams, Buffers and their usage in Java? [closed]
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
开发者_运维问答 Improve this questionI have been coding Java for a while, but I have to admit that I don't get streams, buffers, etc. 100%
I have tried to find a good tutorial on the subject that explains the reasoning behind them and their patterns of usage, but I couldn't find any. Only short, isolated snippets that don't help.
Is there something out there?
The Basic I/O tutorial covers this and does go into some detail.
The best I've ever seen: with great details
http://www.freejavaguide.com/corejava-io.pdf
When you get data from a stream, it is immediately going and fetching the requested bits and pieces directly from the source, similarly to listening to online an radio broadcast. It's like a strictly live feed.
A buffer gets more than just what was requested of the source and stores it in memory so there are not as many requests to get more smaller pieces (constant IO or network bandwidth). This is similar to downloading a radio broadcast and then listening to it... skipping around/going back will not cause extra fetch calls as all/most of the data is already present.
精彩评论