ro.isdc.wro.model.resource.locator.wildcard
Class JarWildcardStreamLocator

java.lang.Object
  extended by ro.isdc.wro.model.resource.locator.wildcard.DefaultWildcardStreamLocator
      extended by ro.isdc.wro.model.resource.locator.wildcard.JarWildcardStreamLocator
All Implemented Interfaces:
WildcardExpanderHandlerAware, WildcardStreamLocator

public class JarWildcardStreamLocator
extends DefaultWildcardStreamLocator

Resolves classpath resources looking for wildcard patterns in both file system and in JAR files.

The locateStream(String, File) overrides the default strategy defined in DefaultWildcardStreamLocator and it tries to open the provided file as a JAR. If that's successfully opened all entries inside this container will be verified against the wildcard pattern. If the JAR-lookup strategy fails, default strategy is invoked.

For the moment this WildcardStreamLocator only supports a single wildcard.

Since:
1.3.6
Author:
Matias Mirabelli

Field Summary
 
Fields inherited from class ro.isdc.wro.model.resource.locator.wildcard.DefaultWildcardStreamLocator
RECURSIVE_WILDCARD
 
Constructor Summary
JarWildcardStreamLocator()
           
 
Method Summary
 InputStream locateStream(String uri, File folder)
          Finds the specified URI pattern inside a JAR file.
 
Methods inherited from class ro.isdc.wro.model.resource.locator.wildcard.DefaultWildcardStreamLocator
hasWildcard, setWildcardExpanderHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarWildcardStreamLocator

public JarWildcardStreamLocator()
Method Detail

locateStream

public InputStream locateStream(String uri,
                                File folder)
                         throws IOException
Finds the specified URI pattern inside a JAR file. If the specified file isn't a valid JAR default strategy will be used instead.

Specified by:
locateStream in interface WildcardStreamLocator
Overrides:
locateStream in class DefaultWildcardStreamLocator
Parameters:
uri - the resource of the uri to locate. This uri should be exactly the same as defined in Resource.
folder - parent from where the search of fileNameWithWildcard should start.
Returns:
InputStream to the resources collection matching the wildcard.
Throws:
IOException - if folder is invalid or when I/O error occurs while locating the stream.


Copyright © 2008-2013. All Rights Reserved.