On Aug 17, 2009, at 11:27am, droidin.net wrote:

Here's what I need to do
1. Read response as a stream
2. Feed it into SAX-based HTML parser "on the fly"
3. When certain tag is detected - terminate the stream

In other words - I'm reading large documents from which I only need top 5%,
can I do it with HttpClient 4?

Use the HttpEntity#getContent() method, which returns an java.io.InputStream, and pass that to your SAX-based HTML parser.

http://hc.apache.org/httpcomponents-client/tutorial/html/fundamentals.html#d4e122

When you see the tag you need, terminate the request via invoking the HttpUriRequest#abort() method.

http://hc.apache.org/httpcomponents-client/tutorial/html/fundamentals.html#d4e285

-- Ken


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to