> > Now, I want to use the java nio to get the InputStream.
> > Because I want to download the data more fast.
>
> I doubt that it would make any difference. By the time
> getResponseBodyAsStream() returns I think you will find it has read the
> entire response into memory prior to obtaining the input stream.
> Thank you for your reply!
> As you know, use the httpclient jar to get the data is the
[quoted text clipped - 14 lines]
>>getResponseBodyAsStream() returns I think you will find it has read the
>>entire response into memory prior to obtaining the input stream.
NIO isn't asynchronous, it's non-blocking: there is a difference; and
Java doesn't support asynchronous I/O. But assuming NIO is what your
teacher wants, it can certainly be done. You'll have to organize sending
and receiving the HTTP headers yourself as the HTTPClient doesn't seem
to support NIO at all. And you need to read this:
http://forum.java.sun.com/thread.jspa?threadID=459338
or even this:
<plug>
http://www.telekinesis.com.au/wipv3_6/FundamentalNetworkingInJava.A21
</plug>
wuweipku@gmail.com - 09 Nov 2006 03:46 GMT
Thank you!
I'm wonder what you say is that when I use the httpclient jar.
The HTTPClient offer the function of the URL of JAVA. It make
more efficiency to get the data than URL.
The HTTPClient use the JAVA i/o.
If I want to replace it with JAVA nio.
I have to realize the function the HTTPClient offer with the nio?
or, Can I just replace the JAVA io of the HTTPClient with the JAVA nio?
I'm just a freshman with JAVA,
Thank you for your reply.
"EJP 写道:
"
> > Thank you for your reply!
> > As you know, use the httpclient jar to get the data is the
[quoted text clipped - 26 lines]
> http://www.telekinesis.com.au/wipv3_6/FundamentalNetworkingInJava.A21
> </plug>