Interface HtmlDerivation.ResourceManager

  • Enclosing class:
    HtmlDerivation

    public static interface HtmlDerivation.ResourceManager
    An interface used to manage external resources (eg images) that are referenced from the HTML
    Since:
    2.29.5
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static HtmlDerivation.ResourceManager INLINE
      A ResourceManager which stores resources as "data" urls for direct embedding into the HTML
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      static java.lang.String filename​(java.lang.String mediaType, int count)
      A convenience method to return a suggested filename for a particular resource
      static HtmlDerivation.ResourceManager newFileResourceManager​(java.nio.file.Path root, java.nio.file.Path relativeTo)
      A ResourceManager which stores resources on the filesystem
      java.lang.String store​(java.lang.String mediaType, java.io.InputStream data)
      Store the specified external resource and return a URL where it could be accessed by the HTML being generated
    • Field Detail

      • INLINE

        static final HtmlDerivation.ResourceManager INLINE
        A ResourceManager which stores resources as "data" urls for direct embedding into the HTML
    • Method Detail

      • store

        java.lang.String store​(java.lang.String mediaType,
                               java.io.InputStream data)
                        throws java.io.IOException
        Store the specified external resource and return a URL where it could be accessed by the HTML being generated
        Parameters:
        mediaType - the media-type of the data
        data - the data itself
        Returns:
        a URI to embed in the generated HTML to access the data
        Throws:
        java.io.IOException
      • filename

        static java.lang.String filename​(java.lang.String mediaType,
                                         int count)
        A convenience method to return a suggested filename for a particular resource
        Parameters:
        mediaType - the mediaType
        count - a number to embed into the filename, eg 2 to get "image-00002.png"
      • newFileResourceManager

        static HtmlDerivation.ResourceManager newFileResourceManager​(java.nio.file.Path root,
                                                                     java.nio.file.Path relativeTo)
                                                              throws java.lang.IllegalArgumentException
        A ResourceManager which stores resources on the filesystem
        Parameters:
        root - the path to store the files
        relativeTo - if not null, any returned URLs will be relative URLs relative to this path.
        Throws:
        java.lang.IllegalArgumentException