Package net.sf.saxon.resource

## Class DirectoryCollection

- java.lang.Object
- - net.sf.saxon.resource.AbstractResourceCollection
  - - net.sf.saxon.resource.DirectoryCollection

- All Implemented Interfaces:
    `ResourceCollection`

      public class DirectoryCollection
      extends AbstractResourceCollection

  This class represents a resource collection containing all, or selected, files within a filestore directory.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.sf.saxon.resource.AbstractResourceCollection

      `AbstractResourceCollection.InputDetails`

  - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.resource.AbstractResourceCollection

      `collectionURI, config, params`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DirectoryCollection​(Configuration config, java.lang.String collectionURI, java.io.File file, URIQueryParameters params)` | Create a directory collection

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected java.util.Iterator<java.lang.String>` | `directoryContents​(java.io.File directory, URIQueryParameters params)` | Return the contents of a collection that maps to a directory in filestore
    `java.util.Iterator<Resource>` | `getResources​(XPathContext context)` | Get the resources in the collection.
    `java.util.Iterator<java.lang.String>` | `getResourceURIs​(XPathContext context)` | Get the URIs of the resources in the collection.
    `boolean` | `stripWhitespace​(SpaceStrippingRule rules)` | Supply information about the whitespace stripping rules that apply to this collection.

    - ### Methods inherited from class net.sf.saxon.resource.AbstractResourceCollection

      `getCollectionURI, getInputDetails, guessContentTypeFromContent, guessContentTypeFromName, isStable, makeResource, makeResource, makeTypedResource, optionsFromQueryParameters, registerContentType, setupErrorHandlingForCollection`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DirectoryCollection

          public DirectoryCollection​(Configuration config,
                                     java.lang.String collectionURI,
                                     java.io.File file,
                                     URIQueryParameters params)
                              throws XPathException

      Create a directory collection
      Parameters:
        `collectionURI` - the collection URI
        `file` - the directory containing the files
        `params` - query parameters supplied as part of the URI
      Throws:
        `XPathException`

  - ### Method Detail

    - #### stripWhitespace

          public boolean stripWhitespace​(SpaceStrippingRule rules)

      Supply information about the whitespace stripping rules that apply to this collection. This method will only be called when the collection() function is invoked from XSLT.
      Specified by:
        `stripWhitespace` in interface `ResourceCollection`
      Overrides:
        `stripWhitespace` in class `AbstractResourceCollection`
      Parameters:
        `rules` - the space-stripping rules that apply to this collection, derived from the xsl:strip-space and xsl:preserve-space declarations in the stylesheet package containing the call to the collection() function.
      Returns:
        true if the collection finder intends to take responsibility for whitespace stripping according to these rules; false if it wishes Saxon itself to post-process any returned XML documents to strip whitespace. Returning true may either indicate that the collection finder will strip whitespace before returning a document, or it may indicate that it does not wish the space stripping rules to be applied. The default (returned by this method if not overridden) is false.

    - #### getResourceURIs

          public java.util.Iterator<java.lang.String> getResourceURIs​(XPathContext context)

      Description copied from interface: `ResourceCollection`
      Get the URIs of the resources in the collection. This supports the fn:uri-collection() function. It is not required that all collections expose a list of URIs in this way, or that the URIs bear any particular relationship to the resources returned by the getResources() method for the same collection URI. The URIs that are returned should be suitable for passing to the registered URIResolver (in the case of XML resources), or the `UnparsedTextURIResolver` (in the case of unparsed text and JSON resources), etc.
      Parameters:
        `context` - the XPath evaluation context
      Returns:
        an iterator over the URIs of the resources in the collection. The URIs are represented as Strings. They should preferably be absolute URIs.

    - #### getResources

          public java.util.Iterator<Resource> getResources​(XPathContext context)

      Description copied from interface: `ResourceCollection`
      Get the resources in the collection. This supports the fn:collection() function. It is not required that all collections expose a set of resources in this way, or that the resources returned bear any particular relationship to the URIs returned by the getResourceURIs() method for the same collection URI.
      Parameters:
        `context` - the XPath evaluation context
      Returns:
        an iterator over the resources in the collection. This returns objects of class `Resource`.

    - #### directoryContents

          protected java.util.Iterator<java.lang.String> directoryContents​(java.io.File directory,
                                                                           URIQueryParameters params)

      Return the contents of a collection that maps to a directory in filestore
      Parameters:
        `directory` - the directory to be processed
        `params` - parameters indicating whether to process recursively, what to do on errors, and which files to select
      Returns:
        an iterator over the absolute URIs of the documents in the collection