In message <[EMAIL PROTECTED]>, 
King Dale writes:
>While looking at the new non-blocking I/O stuff in JDK1.4, it occurred to me
>that there could be a use for a non-blocking matcher. This only applies to
>the AWK stuff as that is the only one that actually works on an input stream
>via the AwkStreamInput (which is a very nice feature that JDK1.4's regex
>package does not have).

I think the JDK 1.4 package can match on streams because it uses
character sequences.  Well, technically I think you can only do it
for files because you can memory map them.  It won't work for
a socket.  At any rate, it's just not clear to me how efficient
java.util.regex is and it's monolithic design is not extensible/reusable.
It would be nice if they included some factories so we could provide
our own implementation of the API and allow for multiple regular
expression syntaxes.  While on the subject of JDK 1.4, does anyone have
any suggestions for multi-platform support from a single Java source
base short of using the C preprocessor?  For a long time I've wanted
to generate separate jars for J2ME, JDK 1.1, 1.2, and 1.3.  I'd
also like to start supporting JDK 1.4 features like CharSequence.
#ifdef is the best way to do this, but there's been strong resistance
to using cpp in the past.

>Instead of having the matcher be a pull model where it blocks waiting for
>input data, you instead push data to it and when it sees a match it notifies
>a listener via an event. Instead of giving it a stream input to read from,
>it would act as FilterOutputStream and moinitor the data that passes through
>it.

This would work with the awk package, but not the Perl stuff unless
you imposed a maximum lookahead the way expect used to do the last
time I ever used it (same reason why Perl5StreamInput disappeared
between the last OROMatcher release and the first jakarta-oro release).
As I understand it, you should have no trouble building this by
funneling data from a PipedOutputStream to a PipedInputStream (or
get the appropriate streams from java.nio.Pipe).

daniel



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to