|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.asual.lesscss.loader.StreamResourceLoader
public abstract class StreamResourceLoader
A base class for loader implementations.
Each loader implementation is associated with a URL schema name. When
requested resource path starts with the loader's associated schema, schema
name is stripped and lookup is retried with plain name instead. Paths
starting with other schema names are rejected, plain names are checked using
openStream(String) - a non null return value indicates valid
resource.
| Constructor Summary | |
|---|---|
StreamResourceLoader()
|
|
| Method Summary | |
|---|---|
boolean |
exists(String path)
Checks if the given resource exists. |
protected abstract String |
getSchema()
Returns the schema name associated with the loader. |
String |
load(String path,
String charset)
Loads the given resource's contents. |
protected abstract InputStream |
openStream(String path)
Returns an InputStream for reading the resource. |
protected String |
readStream(InputStream is,
String charset)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StreamResourceLoader()
| Method Detail |
|---|
protected abstract String getSchema()
protected abstract InputStream openStream(String path)
throws IOException
InputStream for reading the resource.
path - the path of the resource.
InputStream or null if the resource does not
exist.
IOException - when i/o operation fails.
public boolean exists(String path)
throws IOException
ResourceLoader
exists in interface ResourceLoaderpath - resource path.
true if the resource exists.
IOException - when i/o error occurs while checking for resource existence.
public String load(String path,
String charset)
throws IOException
ResourceLoader
load in interface ResourceLoaderpath - resource path.charset - character set name, valid with respect to
Charset.
IOException - when i/o error occurs while loading the resource, or charset
is invalid.
protected String readStream(InputStream is,
String charset)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||