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 丛林 <con...@gm...>:
> 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
>
|