Class TransformerUtils

java.lang.Object
com.atlassian.plugin.webresource.transformer.TransformerUtils

public class TransformerUtils extends Object
Utility class for transforming resources
  • Field Details

    • UTF8

      public static final Charset UTF8
  • Constructor Details

    • TransformerUtils

      public TransformerUtils()
  • Method Details

    • transformAndStreamResource

      public static void transformAndStreamResource(com.atlassian.plugin.servlet.DownloadableResource originalResource, Charset encoding, OutputStream outputStream, Function<CharSequence,CharSequence> transform) throws com.atlassian.plugin.servlet.DownloadException
      Write apply a given transform a resource and then write the transformed content to the supplied OutputStream. Note that the OutputStream will not be closed by this method.
      Parameters:
      originalResource - - the resource to transform
      encoding - - the encoding to use for writing
      outputStream - - the output stream
      transform - - a function for transforming the content
      Throws:
      com.atlassian.plugin.servlet.DownloadException - - thrown if it is not possible to stream the output
      Since:
      2.9.0