Win a copy of Learn Spring Security (video course) this week in the Spring 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic