File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes BufferedReader?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "BufferedReader??" Watch "BufferedReader??" New topic



Joined: Sep 02, 2001
Posts: 6
How do I create a buffered reader and how do I use them???
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
Basic Explanation
A BufferedReader is a "high-level" reader, that is it can't connect directly to a file or input stream. It is used to make more efficient use of low-level readers because they only read in bytes and chars whereas a BufferedReader can read Strings with the readLine() method. It also has some utility methods like skip(), reset() etc.
The code below demonstrates searching a file for a string - it could be a list of passwords or something -. To make this work create a file called "MyFile.dat" in notepad and write a word or words on some lines. one of the lines should contain just "hello" (without the inverted commas). Put this file in the same directory as the BuffRead file.

Hope that helps,
Terry Doyle
Sun Certified Programmer for Java 2 Platform
[This message has been edited by Terence Doyle (edited October 10, 2001).]

Raising Flares debut album 'Ignition' out now

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
I have asked you to change your ID before. Please change your name to be compliant with JavaRanch's naming policy.
Your ID should be 2 separate names with more than 1 letter each. We really want this to be a professional forum and would prefer that you use your REAL name.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: BufferedReader??
It's not a secret anymore!