Re: Construct a "Parser" instant from the original bytes

丛林 <[email protected]> Sun, 1 May 2011 20:06:00 +0800
Newsgroups gmane.comp.parsers.htmlparser.user
Message-ID <[email protected]>
Hi all,

I implement a new constructor to meet this need, with the modifications in

org.htmlparser.Parse
org.htmlparser.lexer.Lexer
org.htmlparser.lexer.Page

Finally, in the org.htmlparser.lexer.Page.setConnection, I create "stream" as:
stream = new Stream(ByteArrayInputStream (bytes[] )),
instead of,
stream = new Stream(getConnection().getInputStream).

While at the same time, I set mConnection as null in this method
setConnection().

With primary test, it works.

Now my question is: Whether these modifications make some other
hiddened errors, especially the null mConnection?

BTW: I think this kind of constructor is useful, just like these are
ByteArrayInputStream and FileInputStream in java.io.InputStream.

Best Wishes,

-Lin




2011/5/1 丛林 <[email protected]>:
> Hi, I am a freshman in htmlparser area.
>
> My problem is:
> How can I construct a "Parser" instant from the original bytes?
> I have to construct a new "Parser" in this way because the original
> bytes is already read from a file to the memory.
>
>
> For example:
> File f = new File("/home/test.html");
> bytes[] b = bufferstreamreadfrom(f);
> Parser p = new Parser(p);                    // how can i construct ?
>
>
>
> Thanks for any suggestion :-)
>
> Best Wishes,
>
> -LIn
>

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Htmlparser-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlparser-user