You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Michael McKibben <mi...@hihat.net> on 2002/02/06 04:42:13 UTC

Usage ? on Source and SourceResolver

Quick question on the usage of the SourceResolver and Source interfaces:

I am writing an implementation of the TRAX URIResolver interface which
delegates to the SourceResolver component. It seems pretty staightforward
to call Source.getInputStream() and wrap that with a TRAX
StreamSource. The question is, is it safe now to call
SourceResolver.release(source), or must I stash this away and discard
later? I am worried that calling release would close the underlying stream
that I just returned in the wrapped StreamSource. Both the Resource and
URL source implementation don't appear to implement Disposable/Recyclable,
but I'm worried I'm relying on an assumption which may not hold for all
Source implementations. 

So is it safe so say that after I call getInputStream() on any Source
impl, I am now the owner of the InputStream and calling release() on the
SourceResolver will not invalidate this stream (how rude!)? 

Thanks in advance, and sorry for all the nagging questions lately. It just
seems that I keep finding ways to use Avalon more and more these days!

Regards,

--mike 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Usage ? on Source and SourceResolver

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
> Michael McKibben wrote:
>
> Quick question on the usage of the SourceResolver and Source interfaces:
>
> I am writing an implementation of the TRAX URIResolver interface which
> delegates to the SourceResolver component. It seems pretty staightforward
> to call Source.getInputStream() and wrap that with a TRAX
> StreamSource. The question is, is it safe now to call
> SourceResolver.release(source), or must I stash this away and discard
> later? I am worried that calling release would close the underlying stream
> that I just returned in the wrapped StreamSource. Both the Resource and
> URL source implementation don't appear to implement Disposable/Recyclable,
> but I'm worried I'm relying on an assumption which may not hold for all
> Source implementations.
>
> So is it safe so say that after I call getInputStream() on any Source
> impl, I am now the owner of the InputStream and calling release() on the
> SourceResolver will not invalidate this stream (how rude!)?
Yes, you are the owner then - you can release the source object and use
the input stream later on.

Carsten
>
> Thanks in advance, and sorry for all the nagging questions lately. It just
> seems that I keep finding ways to use Avalon more and more these days!
>
> Regards,
>
> --mike
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>