Package net.sf.saxon.resource

## Class JarCollection

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

- All Implemented Interfaces:
    `ResourceCollection`

      public class JarCollection
      extends AbstractResourceCollection

  A JarCollection represents a collection of resources held in a JAR or ZIP archive, accessed typically using a URI using the (Java-defined) "jar" URI scheme, or simply a "file" URI where the target file is a JAR or ZIP file.

- - ### 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

      `config, params`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JarCollection​(XPathContext context, java.lang.String collectionURI, URIQueryParameters params)` | Create a JarCollection

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getCollectionURI()` | Get the URI identifying this collection
    `java.util.Iterator<Resource>` | `getResources​(XPathContext context)` | Get an iterator over the resources in the collection
    `java.util.Iterator<java.lang.String>` | `getResourceURIs​(XPathContext context)` | Get the URIs of the resources within the collection
    `protected java.util.Map<java.lang.String,​GroundedValue>` | `makeProperties​(java.util.zip.ZipEntry entry)` | Get the properties of a Zip file entry, for use when returning a MetadataResource containing this information
    `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

      `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

    - #### JarCollection

          public JarCollection​(XPathContext context,
                               java.lang.String collectionURI,
                               URIQueryParameters params)

      Create a JarCollection
      Parameters:
        `context` - The XPath dynamic context
        `collectionURI` - the collection URI used to identify this collection (typically but not necessarily the location of the JAR file)
        `params` - URI query parameters appearing on the collection URI

  - ### 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.

    - #### getCollectionURI

          public java.lang.String getCollectionURI()

      Get the URI identifying this collection
      Specified by:
        `getCollectionURI` in interface `ResourceCollection`
      Overrides:
        `getCollectionURI` in class `AbstractResourceCollection`
      Returns:
        the collection URI

    - #### getResourceURIs

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

      Get the URIs of the resources within the collection
      Parameters:
        `context` - dynamic evaluation context
      Returns:
        a list of all the URIs of resources within the collection. The resources are identified by URIs of the form collection-uri!entry-path
      Throws:
        `XPathException` - if any error occurs accessing the JAR file contents

    - #### getResources

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

      Get an iterator over the resources in the collection
      Parameters:
        `context` - the XPath evaluation context
      Returns:
        an iterator over the resources in the collection. This may include instances of `FailedResource` if there are resources that cannot be processed for some reason.
      Throws:
        `XPathException` - if it is not possible to get an iterator.

    - #### makeProperties

          protected java.util.Map<java.lang.String,​GroundedValue> makeProperties​(java.util.zip.ZipEntry entry)

      Get the properties of a Zip file entry, for use when returning a MetadataResource containing this information
      Parameters:
        `entry` - the current Zip file entry
      Returns:
        a map containing the properties of this entry: comment, compressed-size, crc, extra, compression-method, entry-name, size, and last-modified.