This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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: 198
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.
It is sorta covered in the JavaRanch Style Guide.
subject: java nio