File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes multi-line matcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "multi-line matcher" Watch "multi-line matcher" New topic

multi-line matcher

Natesan Prabhakaran
Ranch Hand

Joined: Jul 11, 2006
Posts: 47
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,


Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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?

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: multi-line matcher
It's not a secret anymore!