File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BufferedReader??

 
rikstar
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I create a buffered reader and how do I use them???
Cheers,
Rikstar
 
Terence Doyle
Ranch Hand
Posts: 328
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
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).]
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rikstar,
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.
Thanks,
Cindy
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic