Package de.xima.fc.workflow
Class TransformingResourceDescriptors
java.lang.Object
de.xima.fc.workflow.TransformingResourceDescriptors
Factory for
IResourceDescriptor that delegate to another descriptor, but transform the resource content in
some manner.- Since:
- 8.0.0
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionstatic IResourceDescriptorstreaming(IResourceDescriptor delegate, ISerializableUnaryOperator<InputStream> transformer) Creates a resource descriptor that that delegates to another descriptor, but applies a transformer to the input stream of the resource's content.static IResourceDescriptortext(IResourceDescriptor delegate, Charset charset, ISerializableUnaryOperator<String> transformer) Creates a resource descriptor that that delegates to another descriptor, but applies a transformer to the plain text content of the resource, using a specifiedCharset.
-
Method Details
-
streaming
public static IResourceDescriptor streaming(IResourceDescriptor delegate, ISerializableUnaryOperator<InputStream> transformer) Creates a resource descriptor that that delegates to another descriptor, but applies a transformer to the input stream of the resource's content. Unliketext(IResourceDescriptor, Charset, ISerializableUnaryOperator), this does not read the content into memory and may be more efficient.- Parameters:
delegate- Delegate from which to obtain the URI and the content.transformer- Transformer that transforms the input stream of the delegate.- Returns:
- A resource descriptor that transforms the resource content with the given transformer.
-
text
public static IResourceDescriptor text(IResourceDescriptor delegate, Charset charset, ISerializableUnaryOperator<String> transformer) Creates a resource descriptor that that delegates to another descriptor, but applies a transformer to the plain text content of the resource, using a specifiedCharset. The content of the resource is read into memory, but only when the resource content is requested.- Parameters:
delegate- Delegate from which to obtain the URI and the content.charset- Charset for reading the content of the delegate as a string and converting the result back to bytes.transformer- Transformer for the resource content.- Returns:
- A resource descriptor that transforms the resource content with the given transformer.
-