Class ResourceStream

java.lang.Object
org.apache.sling.resource.filter.ResourceStream

@ProviderType public class ResourceStream extends Object
Utility to create a Stream of Resource objects from a managed traversal of a Resource tree
  • Field Details

    • resource

      protected Resource resource
  • Constructor Details

    • ResourceStream

      public ResourceStream(Resource resource)
  • Method Details

    • stream

      public Stream<Resource> stream(Predicate<Resource> branchSelector)
      Provides a depth first Stream<Resource> traversal of the resource tree starting with the current resource. The traversal is controlled by the provided predicate which determines if a given child is traversed. If no children matches the predicate, the traversal for that branch ends
      Parameters:
      branchSelector - used to determine whether a given child resource is traversed
      Returns:
      Stream<Resource> of unknown size.
    • listChildren

      public Stream<Resource> listChildren(Predicate<Resource> childSelector)
      Provides a stream of the child resources of the base resource. The predicate is a filter to determine which of the children are returned
      Parameters:
      childSelector -
      Returns: