may someone explain it to more the difference between bufferread and Filereader, in other manning why we need both for File handling i have already searched and dfount out this statment but i could not get it
FileReader is used to read a file from a disk drive whereas BufferedReader is not bound to only reading files. It can be used to read data from any character stream
#I/O file
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
Here is an AI assisted attempt to answer your question 🤖. Maybe it helps! In any case, a human is on the way 👍. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
May someone explain it to more the difference between bufferread and Filereader, in other manning why we need both for File handling i have already searched and dfount out this statment but i could not get it
FileReader is used to read a file from a disk
can't understand it properly:
In Java, FileReader and BufferedReader are two classes used for file handling.
FileReader is used to read characters from a file. It reads data character by character, which can be inefficient when dealing with large files because it involves multiple disk operations.
BufferedReader, on the other hand, is used to read text from a character-input stream, buffering characters so that they can be read more efficiently. It reads data line by line or in larger chunks, which is faster and more efficient compared to using FileReader alone.
In essence, FileReader is used for basic file reading operations while BufferedReader is used for more optimized and efficient reading of text from files.
The reason why both are needed for file handling is that while FileReader provides basic functionality for reading characters from a file, BufferedReader enhances this functionality by providing buffering capabilities that improve performance when reading large amounts of data.
In summary, FileReader is like the basic tool for reading characters from a file while BufferedReader is like a more advanced and efficient tool that optimizes the process of reading text from files. Both have their own specific use cases in Java file handling.
- AI generated response
Readers provide IO support in character form. Not all readers have a buffered source. BufferedReader wraps a reader to add buffering (since many small IO operations is usually inefficient).
No article in this section of that (extremely meh) website covers this
the closest is the one where they randomly rant about the decorator pattern
The Decorator Pattern is one of the 23 Design Patterns from the Gang of Four. The Java I/O API uses this pattern to extend or modify the behavior of some of its classes.
What a fuckin opener
but nowhere in this explanation do they explain what buffering is or why you would do it
Dev.java: The Destination for Java Developers
Using decoration to enhance the capabilities of IO streams.
My bad for just posting a link without explanation but you overlooked the last section of No 1: Understanding the Main Java I/O Concepts and the last section there: Understanding I/O and the links there, specifically the Reader link. I posted the link as a general overview to I/O and to OP's question and to others of my novice skill level that find his/her post interesting. From where I'm from we said something like check yourself and don't trip. I truly was trying to helpful.
that website is the new official tutorials. sadly, a lot of the content was pulled from the old tutorials, without being updated properly
still, its a pretty good source of info, assuming you aren't looking for spoon-feed type levels of assistance
that guide is focused on decorating. it doesnt go into detail about buffered streams because it's not the goal of the guide
introducing buffering is only one of many ways decorating can be useful
should definitely refer to the javadocs for more info on specific types
I like to discourage blindly using that site because so many of the tutorials are bad
or bad for the purpose of being a tutorial
replace "like" with "feel obligated to"
i do wish it was better
but it isn't
This Java tutorial describes exceptions, basic input/output, concurrency, regular expressions, and the platform environment
I like the old java tutorials, the site looks like crap, but there's a lot of very useful information there
I wish they'd update them.
I've read this after doing 10 years of Java, and there were some tidbits I didn't even know 😄
Coming at it from the other side (pascal, c, c++, delphi, VB). Java did set a pretty good early example of a fairly well specified, documented platform. It got high uptake for more reasons that just Sun's advertising budget (though that definitely helped).
dev.java is supposed to be the updated version
you can see they pulled a lot of info from the old tutorials, for example "Walking the File Tree"
It always seems to be missing a heap of stuff
seems they wanted to streamline the tutorials. a lot of the information removed can be found within the javadocs (such as BufferedReader)
there was a LOT of tutorials. here's the full index: https://docs.oracle.com/javase/tutorial/reallybigindex.html
its a lot to maintain
Yeah, but they're so good though