• Post Reply Bookmark Topic Watch Topic
  • New Topic

ByteBuffer deliminating by new line  RSS feed

 
Andrew Mcmurray
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all

I am reading from a socketChannel into a ByteBuffer. I want to cut the input by new lines. What is the best way to handle this? Should I flip the buffer convert to a string and then do the split, or is there a why I can do it at the byte level?

Thanks,

AMD
 
Avinash Ramana
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couldn't you watch for the "\n" in ASCII?

It's "A" in hex..for the newline.

-Avinash
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!