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

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

public class DefaultWildcardStreamLocator
extends Object
implements WildcardStreamLocator, WildcardExpanderHandlerAware

Default implementation of WildcardStreamLocator.

Author:
Alex Objelean

Field Summary
static String RECURSIVE_WILDCARD
          Character to distinguish wildcard inside the uri.
 
Constructor Summary
DefaultWildcardStreamLocator()
           
 
Method Summary
 boolean hasWildcard(String uri)
          
 InputStream locateStream(String uri, File folder)
          Locates the stream based on the fileName containing the wildcard and the folder where to search.
 void setWildcardExpanderHandler(Function<Collection<File>,Void> handler)
          Sets the handler to be used by the implementing class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECURSIVE_WILDCARD

public static final String RECURSIVE_WILDCARD
Character to distinguish wildcard inside the uri.

See Also:
Constant Field Values
Constructor Detail

DefaultWildcardStreamLocator

public DefaultWildcardStreamLocator()
Method Detail

hasWildcard

public boolean hasWildcard(String uri)

Specified by:
hasWildcard in interface WildcardStreamLocator
Parameters:
uri - to check
Returns:
true if the uri contains a wildcard.

locateStream

public InputStream locateStream(String uri,
                                File folder)
                         throws IOException
Locates the stream based on the fileName containing the wildcard and the folder where to search.

Specified by:
locateStream in interface WildcardStreamLocator
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.

setWildcardExpanderHandler

public void setWildcardExpanderHandler(Function<Collection<File>,Void> handler)
Sets the handler to be used by the implementing class.

Specified by:
setWildcardExpanderHandler in interface WildcardExpanderHandlerAware
Parameters:
handler - a Function which does the handler job.


Copyright © 2008-2013. All Rights Reserved.