match regular expression against stream?

  • Thread starter Frank Fredstone
  • Start date
F

Frank Fredstone

Is there a way to use Matcher on a stream of unknown length?

I've seen some examples using streams, but they either expect the
regular expression to be limited to matching lines, or the stream is
from a file where the complete length is known.

If I subclass CharSequence I need to know the entire length, so that's
out... Any ideas?
 
V

VisionSet

Frank Fredstone said:
Is there a way to use Matcher on a stream of unknown length?

I've seen some examples using streams, but they either expect the
regular expression to be limited to matching lines, or the stream is
from a file where the complete length is known.

If I subclass CharSequence I need to know the entire length, so that's
out... Any ideas?

I think the only possible solution would be to buffer the input and cache
the reg exps until they can be ruled out for sure. Each reg exp could be
paired with a pointer into the stream and the buffer can be flushed to the
point of the last cached pointer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top