Resource Streams in Apache Sling | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Peter_Puzanovs
Community Advisor
Community Advisor
October 10, 2018

Dear Dan,

Thank you for sharing this useful information,

Is there any need to close Stream ourselves or would it be hanlded by Sling?

Regards,

Peter

dan_klco
dan_klcoAuthor
October 10, 2018

PuzanovsP​ - The Stream in question is a java.util.stream.Stream so it doesn't need to be closed.

arunpatidar
Community Advisor
Community Advisor
October 10, 2018

Thanks dan.klco​ for sharing this.

When ResourceStream traverse resource or resource tree , is it using kind of index? I am just wondering if it is not using index while search then query should be costly as compare to JCR queries.

Arun Patidar
Radha_Krishna_N
October 28, 2018

Thanks dan.klco​ for the article.

1. Can this API be used to set properties on the resource while traversing?

2. If yes, how do we pass resource resolver to commit?

Thanks,

Radha Krishna N

dan_klco
dan_klcoAuthor
October 31, 2018

Yes, once you have a stream of resources you could perform a forEach action upon those resources. In this case you would probably commit your changes once complete rather than passing in the resolver and committing after every update.