Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java nio

 
bagaria kushal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please tell me how we can read line from bytebuffer
 
Ankit Tripathi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
like-


also you can extract the specific part of data from buffer using utilities like subString,indexOf.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic