[antlr-interest] Parse only <n> bytes from InputStream

andreasharth aharth at gmx.de
Tue Jul 6 07:33:05 PDT 2004


Hi List,

I have written a small HTTP server in Java and like to parse input
from a HTTP PUT operation.  The length of the input in bytes is
specified using the content-length header.  I am able to parse the
stream that's coming in.  So far, so good.

Problem is that the parser should close the Reader after a number of
bytes (the content-length) have been read.  I could first store
everything the HTTP server recieves, and then parse that, but since I
want to process megabytes (and maybe gigabytes) caching things is not
really an option.  I cannot specify and end of file symbol either
because that's not in the HTTP protocol.

Is there a way to make the parser stop after having read a given
number of bytes?

Cheers,
Andreas.




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list