hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Ferguson <doug...@douglasferguson.us>
Subject Re: getResponseBodyAsStream vs. getResponseBodyAsString
Date Thu, 08 Oct 2009 17:42:05 GMT
It really depends on your usecase.

getResponseBodyAsString will buffer the entire response into a String,  
which could cause unnecessary memory usage. If you are going to turn  
around and stream the response somewhere, i.e. disc or servlet response.

Also, keep in mind that getResponseBodyAsString will have to deal with  
character encoding. My experience with 3.1 is that it doesn't work too  
well. I had to override it with the mozilla library for charset  
detection.


Hope this helps.

Douglas


On Oct 8, 2009, at 12:25 PM, Randy Paries wrote:

> I was wondering if someone could give me insight on when to use
> getResponseBodyAsStream vs. getResponseBodyAsString
>
> The  getResponseBodyAsString seems to be very straight forward but
> would like to understand the best scenarios for each
>
> thanks
> Randy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message