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

java nio

bagaria kushal

Joined: Mar 29, 2011
Posts: 19
Please tell me how we can read line from bytebuffer
Ankit Tripathi
Ranch Hand

Joined: Oct 17, 2009
Posts: 199
Hi Bagaria,Welcome to JavaRanch Community.....

ByteBuffer class uses channels like "FileChannel" to read data from files.
Have you seen methods available ByteBuffer and FileChannel classes?
I think there is no readLine() method available.
But you can do similar by allocating a buffer size and than setting initial offset and capacity

also you can extract the specific part of data from buffer using utilities like subString,indexOf.
I agree. Here's the link:
subject: java nio
It's not a secret anymore!