You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by John Smith <de...@gmail.com> on 2010/11/24 13:59:32 UTC
How many bytes did I get?
Hello everyone!
I describe my situation.
I download some content from some sites by HttpClient.
I send GET request and get HttpEntity to byte array:
bEntity = EntityUtils.toByteArray(entity);
then I save bEntity in file.
I can see content size by entity.getContentLength(),
but I need to know how many bytes I've already got when I'm downloading content.
Has HttpClient or HttpEntity got some implements for it?
Thanks for your help!
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: How many bytes did I get?
Posted by John Smith <de...@gmail.com>.
On 25 of November 2010 16:38:59 Oleg Kalnichevski wrote:
> On Thu, 2010-11-25 at 06:37 +0200, John Smith wrote:
> >
> > I would like a process indicator, not final total.
>
> So, what is the problem? Just count the number of bytes read so far
> while reading from InputStream returned by HttpEntity#getContent.
> HttpEntity#getContentLength will give you the expected total if known.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
Right you are! I just forget about it, sorry.
Thanks for your time!
--
Faithfully yours, John.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: How many bytes did I get?
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2010-11-25 at 06:37 +0200, John Smith wrote:
> On 24 of November 2010 23:09:30 Oleg Kalnichevski wrote:
> > On Wed, 2010-11-24 at 14:59 +0200, John Smith wrote:
> >
> > Do you want just the final total or you intermediate data for a process
> > indicator of some kind?
> >
> > Oleg
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
>
> I would like a process indicator, not final total.
>
So, what is the problem? Just count the number of bytes read so far
while reading from InputStream returned by HttpEntity#getContent.
HttpEntity#getContentLength will give you the expected total if known.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: How many bytes did I get?
Posted by John Smith <de...@gmail.com>.
On 24 of November 2010 23:09:30 Oleg Kalnichevski wrote:
> On Wed, 2010-11-24 at 14:59 +0200, John Smith wrote:
>
> Do you want just the final total or you intermediate data for a process
> indicator of some kind?
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
I would like a process indicator, not final total.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: How many bytes did I get?
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2010-11-24 at 14:59 +0200, John Smith wrote:
> Hello everyone!
> I describe my situation.
>
> I download some content from some sites by HttpClient.
> I send GET request and get HttpEntity to byte array:
>
> bEntity = EntityUtils.toByteArray(entity);
> then I save bEntity in file.
>
> I can see content size by entity.getContentLength(),
> but I need to know how many bytes I've already got when I'm downloading content.
>
> Has HttpClient or HttpEntity got some implements for it?
>
> Thanks for your help!
>
Do you want just the final total or you intermediate data for a process
indicator of some kind?
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org