Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multi-line matcher

 
Natesan Prabhakaran
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai, can you please explain how to read full content of buffer or a file at a time. i want to use a multline matcher for a file content..thanks,

regards
prabhakaran
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For any stream you can read bytes and append them to a StringBuffer. For a file or any stream where you might know the number of bytes to expect, you can read into a byte array of exactly the right size in a single shot. And somebody once posted a cute Scanner trick to read a stream into a string in one line using EOF as the delimiter.

Is that the right kind of thing?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic