"Hello, Amigo! You've been using the BufferedReader and InputStreamReader classes for a long time. Now let's explore what they actually do."
The InputStreamReader class is a classic adapter from the InputStream interface to the Reader interface. There's nothing to add here either.
But in short, this is what happens. When you request (read) the next character from an InputStreamReader object, it reads a few bytes from InputStream passed to the constructor, and returns them as one char.
But Reader isn't the most convenient object to work with. Often what we need is not to read all the characters entered by the user all at once, but rather to split these characters into lines.
"But the Reader class has a read(CharBuffer s) method. Can't we use that?"
"This method reads data in chunks the size of the buffer and places them in the CharBuffer object."
Text is usually divided into lines. So the read(CharBuffer s) method might read several lines all at once. If we need to read text exactly up to the end of a line (i.e. all the characters in a line until a newline character), it would be better to look for something else. And an alternative method does exist. In the BufferedReader class.
The BufferedReader class, which is a convenient structure on top of Reader, has one very convenient method: readLine(). This method lets us read whole lines of text from a Reader at all once. When you call readLine in your code, it reads characters from the Reader object until it encounters a newline character. Once the newline character is encountered, the method glues these characters together in a single string and returns it.
"I've used this regularly, but I didn't know how it works. Now I know. Thanks, Kim."