Class JarCollection

  • All Implemented Interfaces:

    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.
    • Constructor Detail

      • JarCollection

        public JarCollection​(XPathContext context,
                             java.lang.String collectionURI,
                             URIQueryParameters params)
        Create a JarCollection
        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.
        stripWhitespace in class AbstractResourceCollection
        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.
        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)
                                                             throws XPathException
        Get the URIs of the resources within the collection
        context - dynamic evaluation context
        a list of all the URIs of resources within the collection. The resources are identified by URIs of the form collection-uri!entry-path
        XPathException - if any error occurs accessing the JAR file contents
      • getResources

        public java.util.Iterator<? extends Resource> getResources​(XPathContext context)
                                                            throws XPathException
        Get an iterator over the resources in the collection
        context - the XPath evaluation context
        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.
        XPathException - if it is not possible to get an iterator.
      • makeProperties

        protected java.util.Map<java.lang.String,​GroundedValue> makeProperties​( entry)
        Get the properties of a Zip file entry, for use when returning a MetadataResource containing this information
        entry - the current Zip file entry
        a map containing the properties of this entry: comment, compressed-size, crc, extra, compression-method, entry-name, size, and last-modified.