public class StringResource extends Object implements Renderable
A StringResource instance encapsulates such a content for rendering on a html canvas.
Examples
html.text(StringResource.get("content/Introduction.html"), false);
html.render(new StringResource("content/Introduction.html"));
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DO_NOT_CACHE
Intention revealing constant to emphasize that caching for an item is not needed
|
| Constructor and Description |
|---|
StringResource(String location)
Create a StringResource with the cached value read from the resource location
|
StringResource(String location,
boolean escapeNeeded)
Create a StringResource with the cached value read from the resource location.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
flush()
Forget about all cached resources.
|
static void |
flush(String location)
Forget about the cached resource at the location.
|
static String |
get(String location)
Access the String contents from the given resource location.
|
static String |
get(String location,
boolean doCache)
Access the String contents from the given resource location.
|
void |
renderOn(HtmlCanvas html)
Write the content as text using the html.
|
static StringResource |
valueOf(String location)
Return a StringResource for rendering the text available at
location |
public static final boolean DO_NOT_CACHE
public StringResource(String location)
location - public StringResource(String location, boolean escapeNeeded)
location - escapeNeeded - public static String get(String location)
location - public static void flush(String location)
location - public static void flush()
public static String get(String location, boolean doCache)
location - public static StringResource valueOf(String location)
locationlocation - , the file on the classpath containing the resource textpublic void renderOn(HtmlCanvas html) throws IOException
renderOn in interface RenderableIOExceptionCopyright © 2010–2018. All rights reserved.