com.asual.lesscss.loader
Class ChainedResourceLoader

java.lang.Object
  extended by com.asual.lesscss.loader.ChainedResourceLoader
All Implemented Interfaces:
ResourceLoader

public class ChainedResourceLoader
extends Object
implements ResourceLoader

A ResourceLoader delegates to a sequence of other loaders, asking each one for the requested resource in turn.

Author:
RafaƂ Krzewski

Constructor Summary
ChainedResourceLoader(ResourceLoader... loaders)
          Creates a new ChainedResourceLoader.
 
Method Summary
 boolean exists(String path)
          Returns true, if any of the delegate loaders returns from exists(String) for the given path.
 String load(String path, String charset)
          The first delegate that returns from exists(String) for the given path will have load(String, String) invoked, and the result will be retured.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainedResourceLoader

public ChainedResourceLoader(ResourceLoader... loaders)
Creates a new ChainedResourceLoader.

Parameters:
loaders - the loaders to delegate to. Order of the loaders is important.
Method Detail

exists

public boolean exists(String path)
               throws IOException
Returns true, if any of the delegate loaders returns from exists(String) for the given path.

Specified by:
exists in interface ResourceLoader
Parameters:
path - resource path.
Returns:
true if the resource exists.
Throws:
IOException - when i/o error occurs while checking for resource existence.

load

public String load(String path,
                   String charset)
            throws IOException
The first delegate that returns from exists(String) for the given path will have load(String, String) invoked, and the result will be retured.

Specified by:
load in interface ResourceLoader
Parameters:
path - resource path.
charset - character set name, valid with respect to Charset.
Returns:
resource contents as a string.
Throws:
IOException - when i/o error occurs while loading the resource, or charset is invalid.


Copyright © 2013 Asual DZZD. All Rights Reserved.