Class TransformingResourceDescriptors


  • public final class TransformingResourceDescriptors
    extends Object
    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 Detail

      • 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 specified Charset. 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.