#I/O file

1 messages · Page 1 of 1 (latest)

wraith socket
#

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

ocean solsticeBOT
#

<@&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>.

#
TJ-Bot
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.

meager parcel
#

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).

sweet gorge
twin rock
#

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

sweet gorge
# twin rock No article in this section of that (extremely meh) website covers this

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.

flat breach
#

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

twin rock
#

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

proven tide
#

I like the old java tutorials, the site looks like crap, but there's a lot of very useful information there

meager parcel
#

I wish they'd update them.

proven tide
#

I've read this after doing 10 years of Java, and there were some tidbits I didn't even know 😄

meager parcel
#

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).

flat breach
#

you can see they pulled a lot of info from the old tutorials, for example "Walking the File Tree"

proven tide
#

It always seems to be missing a heap of stuff

flat breach
#

its a lot to maintain

proven tide
#

Yeah, but they're so good though