[antlr-interest] Re: Parse only <n> bytes from InputStream
    Ric Klaren 
    klaren at cs.utwente.nl
       
    Thu Jul  8 02:48:42 PDT 2004
    
    
  
On Wed, Jul 07, 2004 at 04:30:15PM -0000, andreasharth wrote:
> thanks for your reply.  I tried to extend CharBuffer.fill() with
> 	    
> // n bytes are read (for http content-length)
> _read += amount;
> 
> // read enough? close input
> if (_read >= _contentLength) {
>   input.close();
> }
> 
> but that didn't do the trick, the connection is closed way to early. 
> I presume that fill() is called more than once for every chunk of
> input?  
Yup it is. Try inserting a fake EOF in the queue in fill. You probably also
need something to remove a fake EOF from this queue again to be able to
restart the parser.
> A related question: when does the lexer stop reading in new characters
> in the general case?
Upon end of file.
Cheers,
Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755  ----
-----+++++*****************************************************+++++++++-------
  Quidquid latine dictum sit, altum viditur.
                 (Whatever is said in Latin sounds profound.)
 
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