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 Eugeny N Dzhurinsky <bo...@redwerk.com> on 2007/06/04 17:58:27 UTC

close stream

Hello, could you please explain - if I get a stream from Get/PostMethod, do I
need to explicitly close it  when I read all required data, or it is done 
when I call httpmethod.abort() ?

-- 
Eugene N Dzhurinsky

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


Re: close stream

Posted by Roland Weber <os...@dubioso.net>.
Hello Eugany,

Eugeny N Dzhurinsky wrote:
> On Tue, Jun 05, 2007 at 07:52:16AM +0200, Roland Weber wrote:
>> Hello Eugeny,
>>
>>> Hello, could you please explain - if I get a stream from Get/PostMethod, 
>> do I
>>> need to explicitly close it  when I read all required data, or it is 
>> done 
>>> when I call httpmethod.abort() ?
>> method.abort() will close the stream for you. Do NOT close the stream
>> before calling abort(), since that would read the remaining data.
> 
> Okay, so to ensure everything is working as desired (I have a set of stream
> wrappers to decode gzipped streams etc) I need to call httpmethod.abort()
> first (which would close underlying http stream) and then close stream with
> stream.close() method?

HttpClient requires no more than method.abort(). I'm really
not in a position to tell what your wrappers need for cleanup.
In case of a doubt, it's better to be safe than sorry.

cheers,
  Roland


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


Re: close stream

Posted by Eugeny N Dzhurinsky <bo...@redwerk.com>.
On Tue, Jun 05, 2007 at 07:52:16AM +0200, Roland Weber wrote:
> Hello Eugeny,
> 
> > Hello, could you please explain - if I get a stream from Get/PostMethod, 
> do I
> > need to explicitly close it  when I read all required data, or it is 
> done 
> > when I call httpmethod.abort() ?
> 
> method.abort() will close the stream for you. Do NOT close the stream
> before calling abort(), since that would read the remaining data.

Okay, so to ensure everything is working as desired (I have a set of stream
wrappers to decode gzipped streams etc) I need to call httpmethod.abort()
first (which would close underlying http stream) and then close stream with
stream.close() method?


-- 
Eugene N Dzhurinsky

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


Re: close stream

Posted by Roland Weber <RO...@de.ibm.com>.
Hello Eugeny,

> Hello, could you please explain - if I get a stream from Get/PostMethod, 
do I
> need to explicitly close it  when I read all required data, or it is 
done 
> when I call httpmethod.abort() ?

method.abort() will close the stream for you. Do NOT close the stream
before calling abort(), since that would read the remaining data.

cheers,
  Roland