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, noExceptions, 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 collectionjava.util.Iterator<? extends Resource>
getResources(XPathContext context)
Get an iterator over the resources in the collectionjava.util.Iterator<java.lang.String>
getResourceURIs(XPathContext context)
Get the URIs of the resources within the collectionprotected 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 informationboolean
stripWhitespace(SpaceStrippingRule rules)
Supply information about the whitespace stripping rules that apply to this collection.-
Methods inherited from class net.sf.saxon.resource.AbstractResourceCollection
checkNotNull, getInputDetails, guessContentTypeFromContent, guessContentTypeFromName, isStable, makeResource, makeResource, makeTypedResource, optionsFromQueryParameters, registerContentType, setupErrorHandlingForCollection
-
-
-
-
Constructor Detail
-
JarCollection
public JarCollection(XPathContext context, java.lang.String collectionURI, URIQueryParameters params)
Create a JarCollection- Parameters:
context
- The XPath dynamic contextcollectionURI
- 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.- Overrides:
stripWhitespace
in classAbstractResourceCollection
- 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 interfaceResourceCollection
- Overrides:
getCollectionURI
in classAbstractResourceCollection
- 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<? extends 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.
-
-