Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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

Win a copy of The Software Craftsman this week in the Agile forum!
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.
subject: java nio