Class Overview
Abstract class that makes it easy to create transforms that go from string to string. Override
getEncoding()
to customize the character encoding of the underlying content and transformed content.
For example, here is a minimal transformer that prepends text to the underlying resource:
public class PrefixTransformer implements WebResourceTransformer
{
public DownloadableResource transform(Element configElement, ResourceLocation location, String filePath, DownloadableResource nextResource)
{
return new AbstractStringTransformedDownloadableResource(nextResource)
{
protected String transform(String originalContent)
{
return "Prefix: " + originalContent;
}
};
}
}
Public Constructors
Public Methods
Protected Methods
protected
String
getEncoding
()
Returns
- the encoding used to read the original resource and encode the transformed string
protected
abstract
String
transform
(String originalContent)
Override this method to transform the original content into a new format.
Parameters
originalContent
| The original content from the original downloadable resource. |
Returns
- The transformed content you want returned