File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes read chunks instead of lines with bufferReader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "read chunks instead of lines with bufferReader" Watch "read chunks instead of lines with bufferReader" New topic
Author

read chunks instead of lines with bufferReader

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
how can i read a chunk of 'words'/chars from a file?

instead of:

while ((line=bufReader.readLine()) != null)

I would like to read 128 bytes of code.

can anyone assist?

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

If you want to read 128 bytes (or 128 characters), then you don't need a BufferedReader at all.



[Jess in Action][AskingGoodQuestions]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: read chunks instead of lines with bufferReader